PHP连接MySQL错误 Access denied for user 'root'@'localhost' (using password: YES)

由于在mysql中设置了密码,通过phpMyAdmin访问时不能输入密码,是通过配置文件的方式加载密码的。所以需要将数据库的密码写到PHP的配置文件中。

这时我们只需要为PHPMYAdmin目录下的config.ini.php中$cfg['Servers'][$i]['controlpass']=""添加您的MySQL密码即可。连接数据库的时候数据库密码不要填即可。

 


posted @ 2019-06-10 18:20  余鱼瑜渔  阅读(2637)  评论(0编辑  收藏  举报