我无法创建迁移 Laravel5 用户 'homestead'@'localhost' 的访问被拒绝(使用密码:YES)

I can't create migration Laravel5 Access denied for user 'homestead'@'localhost' (using password: YES)

终端显示这条消息:

我的环境:

我的database.php:

'default' => env('DB_CONNECTION', 'mysql'),
'mysql' => [
  'driver' => 'mysql',
  'host' => env('DB_HOST', '127.0.0.1'),
  'port' => env('DB_PORT', '3306'),
  'database' => env('DB_DATABASE', 'laravelup'),
  'username' => env('DB_USERNAME', 'root'),            
  'password' => env('DB_PASSWORD', '1'),
  'unix_socket' => env('DB_SOCKET', ''),   
  'charset' => 'utf8mb4',    
  'collation' => 'utf8mb4_unicode_ci',    
  'prefix' => '',  
  'strict' => true,
  'engine' => null,        
],

我该如何解决这个问题?

只需像这样更改您的 .env 文件

DB_DATABASE=laravelup
DB_USERNAME=root
DB_PASSWORD=                  //blank here

它会起作用的。

我可能 laravel 配置缓存问题。

If you type this command "php artisan config:clear" and try again, then it will be working.