意外的异常:SQLSTATE [HY000] [1045]用户**** @'localhost'的访问被拒绝(使用密码:是) [英] Unexpected Exception: SQLSTATE[HY000] [1045] Access denied for user ****@'localhost' (using password: YES)
问题描述
一个老同事把申请交给我来管理.但是,每当我尝试运行它时,都会不断出现此错误.请任何帮助.
An application was handed to me by an old colleague to manage. However, whenever I try to run it, I keep getting this error. Please any help would do.
推荐答案
有时访问被拒绝异常错误,因为您的mysql凭据无效. 其次,根据我的经验,我发现这也是因为您没有为数据库连接设置密码而发生的.例如
Sometimes Access denied Exception Error because your mysql credentials are invalid. Secondly, from my experience i observed that this also happens because you did not set password to your database connectivity. eg
private $host = "localhost";
private $db_name = "db_dbtest"; // Database name
private $username = "db_user"; // your database username
private $password = "db_password"; // Your password
public $conn;
}
尝试为数据库连接设置密码.我有这样的经验,并且在操作"选项卡上将排序规则"更改为utf8_general_ci之后,这无法解决我的问题.我想到将密码添加到我的数据库连接中,并立即将其连接. 您可以试一下,看看是否有帮助.
Try and set password to your database connectivity. I had such experience and after changing my Collation to utf8_general_ci on the Operations tab, this could not solve my problem. I thought of adding password to my database connection and immediately it connected. You can tesrun this and see if it helps.
这篇关于意外的异常:SQLSTATE [HY000] [1045]用户**** @'localhost'的访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!