本文介绍了驱动程序中发生异常:SQLSTATE [HY000] [1045]用户'db_user'@'localhost'的访问被拒绝(使用密码:是)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了这个
来向我的symfony项目添加理论(v4.2)。但是,当安装了学说后,它就不会将此行添加到我的项目中(如文档中提到的那样在我的.env文件中):

I followed this documentationto add doctrine to my symfony project(v4.2). But when doctrine is installed it deosn't add this line to my project ( in my .env file like mentioned in the doc ):

所以我这样手动添加了它:

So I added it manually like this :

并使用此命令创建数据库:

and used this commande to create the database :

它给了我这个错误:

在PDOConnection.php第31行中:
SQLSTATE [HY000] [1045]用户'db_user'@'localhost'的访问被拒绝(使用密码:是)

在PDOConnection.php第27行:
SQLSTATE [HY000] [1045] ]用户'db_user'@'localhost'的访问被拒绝(使用密码:是)

In PDOConnection.php line 31: SQLSTATE[HY000] [1045] Access denied for user 'db_user'@'localhost' (using password: YES)
In PDOConnection.php line 27: SQLSTATE[HY000] [1045] Access denied for user 'db_user'@'localhost' (using password: YES)

即使我仍然更改了用户名和密码不认识它。知道为什么它不起作用吗?我会很感激的。

Even I changed the user and password it still dosn't recognize it . Any idea why it dosn't work ? I will appreciate it .

推荐答案

这种方法对我来说似乎不起作用,我不知道为什么,但是它如此工作:

This method seem to not work for me I dont kniw why but it worked this way :


  • 所以我用Flex安装了原理:

然后我运行此命令:




  • 然后我去了到我的文件 .env ,我发现我的数据库语法自动生成,并且一切正常。

    • then I went to my file .env and I found my database syntax generated automaticlyy and everything worked fine .

      也我删除了在计算机上打开的其他sql处理器(我也安装了sql server +解释了我所遇到的冲突的wamp),然后重新打开了wamp服务器,一切正常。

      Also I deleted the other sql processors that were open on my computer ( i hv installed sql server too + wamp which explaine the conflict that I have) and then re-opened my wamp server and everything is working fine.

      这篇关于驱动程序中发生异常:SQLSTATE [HY000] [1045]用户'db_user'@'localhost'的访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:10