[英]laravel 5 Access denied for user 'root'@' localhost' (using password: YES)
I am new to Laravel5. 我是Laravel5的新手。 I tried to create migration table but I get this error
我尝试创建迁移表,但出现此错误
This is the database.php 这是database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'larashop'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'melody'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
and this is .env 这是.env
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=larashop
DB_USERNAME=root
DB_PASSWORD=melody
Please help. 请帮忙。
Your screenshot shows "localhost" and your code shows "127.0.0.1". 屏幕快照显示“ localhost”,代码显示“ 127.0.0.1”。 MySQL treats "localhost" and "127.0.0.1" differently.
MySQL对“ localhost”和“ 127.0.0.1”的处理不同。
Make sure you have granted appropriate permissions for 'root'@'localhost' in your database. 确保您已为数据库中的'root'@'localhost'授予适当的权限。
http://dev.mysql.com/doc/refman/5.7/en/grant.html http://dev.mysql.com/doc/refman/5.7/en/grant.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.