迁移时出现这些错误
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: YES) (SQL: select * from information_
schema.tables where table_schema = computersale and table_name = migrations)
和
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: YES)
我的配置:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'computersale'),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', 'root'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
和
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=computersale
DB_USERNAME=
DB_PASSWORD=root
我尝试清除缓存和 config 但是没有用。