我正在将laravel应用程序部署到heroku。一切都很好,但是当我不得不迁移我的数据库(在phpmyadmin上)时,在执行命令php artisan migration时出现以下错误。
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema =
database_lms and table_name = migrations)
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000] [2002] No such file or directory
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
我有一个名为database_lms的数据库,其中有迁移表。 这是我的.env文件
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=database_lms
DB_USERNAME=root
DB_PASSWORD=
这是我的config / database.php文件,其中包含mysql参数
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'database_lms'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
我尝试将DB_HOST更改为127.0.0.1,但这也不起作用。 我还运行了php artisan config:cache,然后运行php artisan migration,但遇到了同样的错误。有关如何解决此问题的任何想法?