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

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

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


原文地址:https://www.cnblogs.com/goubb/p/10999416.html