我正在通过快速入门指南,并进入实际连接到数据库以获取用户表的部分,并收到以下错误:
SQLSTATE [28000] [1045]拒绝访问用户'root'@'localhost'(使用密码:NO)
我database.php
包括以下设置(默认设置为mysql):
'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'bt', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),
然而,当我进入终端窗口时,我可以使用登录mysql -h localhost -u root -p
然后只需按Enter键进入而没有密码,我认为这是相同的(当我运行时'bt'表出现show databases();
).我在这里错过了什么?
我认为这是解决方案:)
'mysql' => array( 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'bt', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefi