phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)

问题描述

Wampserver(3.0.6 - 64bit) phpmyadmin(4.6.4)密码为空连接Mysql(5.7.14)出现 #1045 - Access denied for user ‘root’@‘localhost’ (using password: NO) 与 mysqli_real_connect(): (HY000/1045): Access denied for user ‘root’@‘localhost’ (using password: NO)

如图

phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第1张图片

解决办法

先介绍我搜到的方法(我的没效果)

修改D:\wamp64\apps\phpmyadmin4.6.4\libraries\ config.default.php(这是我的文件路径,你要在你自己的路径下找到这个文件)

  • step1

修改 $cfg[‘Servers’][$i][‘password’] = ‘’; 字段为空phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第2张图片

  • step2

修改 $cfg[‘Servers’][$i][‘nopassword’] = false; 字段为truephpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第3张图片

  • step3

修改 $cfg[‘Servers’][$i][‘AllowNoPassword’] = false; 字段为truephpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第4张图片

  • step4
    -登录

结果还是没进去
phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第5张图片

我用的方法(仅在我的电脑上试过,而且不知道原因,但是可以用空密码登录了)

修改D:\wamp64\apps\phpmyadmin4.6.4\ config.inc.php(这是我的文件路径,你要在你自己的路径下找到这个文件)

  • step1

修改 $cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’; 字段为 localhostphpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第6张图片phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第7张图片

  • step2

登录成功了
phpmyadmin密码为空连接Mysql出现 #1045 - Access denied for user 'root'@'localhost' (using password: NO)_第8张图片

你可能感兴趣的:(PHP)