且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

意外的异常:SQLSTATE [HY000] [1045]用户**** @'localhost'的访问被拒绝(使用密码:是)

更新时间:2021-10-27 22:27:55

有时访问被拒绝异常错误,因为您的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.