简体   繁体   English

PDOException: SQLSTATE[28000] [1698] 用户 'root'@'localhost' Symfony2 的访问被拒绝

[英]PDOException: SQLSTATE[28000] [1698] Access denied for user 'root'@'localhost' Symfony2

I keep getting this error and I don't know how to fix it.我一直收到这个错误,我不知道如何解决它。 When I type in the shell mysql -u root -p and type the password, I can log in to mysql.当我在shell中输入mysql -u root -p并输入密码后,就可以登录mysql了。 The strange thing is that, I can log in without password too.奇怪的是,我也可以不用密码登录。 If I open my project in the browser, I get this error.如果我在浏览器中打开我的项目,我会收到此错误。 I tried the parameters_test.yml with and without password, still not working.我尝试了带和不带密码的 parameters_test.yml,仍然无法正常工作。 It just writes: PDOException: SQLSTATE[28000] [1698] Access denied for user 'root'@'localhost' .它只是写道: PDOException: SQLSTATE[28000] [1698] Access denied for user 'root'@'localhost' It doesn't gives me the reason, the project just thinks I don't have access to the db.它没有给我原因,该项目只是认为我无权访问数据库。 I have mariadb 10 installed.我安装了 mariadb 10。 Thanks for the help in advance!我在这里先向您的帮助表示感谢!

Although it is strange that you can access through terminal, You have made the grant?虽然很奇怪你可以通过终端访问,你已经授权了吗?

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'; // For root without password            
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'Your_Password'; // For root with password

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PDOException SQLSTATE [28000] [1045]拒绝访问用户'homestead'@'localhost' - PDOException SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' SQLSTATE[HY000] [1698] 用户 'root'@'localhost' 的访问被拒绝 - SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' PDOException:SQLSTATE [28000] [1045]用户的访问被拒绝 - PDOException: SQLSTATE[28000] [1045] Access denied for user SQLSTATE [28000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:NO) - SQLSTATE[28000][1045] Access denied for user 'root'@'localhost'(using password:NO) SQLSTATE [28000] [1045]用户'root'拒绝访问 - SQLSTATE[28000] [1045] Access denied for user 'root' SQLSTATE [HY000] [1698] laravel 中用户“root”@“localhost”的访问被拒绝 - SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in laravel 7 SQLSTATE [HY000] [1045] 用户'root'@'localhost'的访问被拒绝(使用密码:YES)symfony2 - SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) symfony2 FOSUserBundle-SQLSTATE [28000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:NO) - FOSUserBundle - SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) SQLSTATE [28000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:NO)生产中的Laravel - SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Laravel in production SQLSTATE [28000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:是) - SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM