简体   繁体   English

laravel 5用户“ root” @“ localhost”的访问被拒绝(使用密码:是)

[英]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 我尝试创建迁移表,但出现此错误

Error Log 错误记录

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.

相关问题 在 laravel 4.2 中,用户 'root'@'localhost' 的 Laravel 访问被拒绝(使用密码:YES) - Laravel Access denied for user 'root'@'localhost' (using password: YES) in laravel 4.2 使用MAMP拒绝用户'root'@'localhost'的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) using MAMP 用户 'root'@'localhost' 的访问被拒绝(使用密码:YES)' - Access denied for user 'root'@'localhost' (using password: YES)' 用户'root'@'localhost'的访问被拒绝(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) #1045-用户'root'@'localhost'的访问被拒绝(使用密码:是) - #1045 - Access denied for user 'root'@'localhost' (using password: YES) PHP Laravel:用户'homestead'@'localhost'的访问被拒绝(使用密码:是) - PHP Laravel : Access denied for user 'homestead'@'localhost' (using password: YES) 重置 root 密码后,用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - Access denied for user 'root'@'localhost' (using password: YES) after resetting root password xampp localhost phpmyadmin 用户 'root'@'localhost' 访问被拒绝(使用密码:YES) - xampp localhost phpmyadmin Access denied for user 'root'@'localhost' (using password: YES) 使用MAMP服务器拒绝用户'root'@'localhost'的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) using MAMP server 使用 ssh 隧道连接的用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - Access denied for user 'root'@'localhost' (using password: YES) using ssh tunnel connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM