修复 phpMyAdmin 用户“root"@“localhost"拒绝访问的问题 [英] Fix Access denied for user 'root'@'localhost' for phpMyAdmin
问题描述
我在 PC 上使用 WAMP Server 2.2.在 phpMyAdmin(5.5.24 版)中,我编辑了root"用户(使用localhost"主机)并给它一个密码root".结果证明这是一个我试图恢复的大错误.现在,当我转到 localhost/phpmyadmin/ 时,我会看到左侧的数据库菜单,但主框架有一个错误,内容如下:
I'm using WAMP Server 2.2 on a PC. In phpMyAdmin (version 5.5.24) I edited the 'root' user (with 'localhost' host) and gave it a password of 'root'. This turned out to be a big mistake that I'm trying to revert. Now when I go to localhost/phpmyadmin/ I get the menu of databases on the left, but the main frame has an error that reads:
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the
connection. You should check the host, username and password in your
configuration and make sure that they correspond to the information given
by the administrator of the MySQL server.
如果我转到 127.0.0.1/phpmyadmin,我不会收到错误并且一切正常.
If I go to 127.0.0.1/phpmyadmin, I do not get the error and everything works fine.
我尝试将用户密码改回无密码;我尝试修改 config.inc.php 文件以添加新密码(但这使 phpMyAdmin 完全出错);我尝试删除并重新创建 root/localhost 用户.似乎没有任何效果.root/localhost 用户似乎没有密码和所有权限,但错误仍然存在.
I tried changing the user's password back to no password; I tried modifying config.inc.php file to add the new password (but that made phpMyAdmin error-out completely); I tried removing and recreating the root/localhost user. Nothing seems to work. The root/localhost user appears to have no password and all privileges, but the error remains.
有什么想法或如何使该用户的访问权限恢复正常而无需重新安装 WAMP?
Any ideas or how I can get this user's access back to normal without having to reinstall WAMP?
推荐答案
在C:\wamp\apps\phpmyadmin3.5.1
下找到config.inc
文件在这个文件里面找到这一行
Find config.inc
file under C:\wamp\apps\phpmyadmin3.5.1
Inside this file find
this one line
$cfg['Servers'][$i]['password'] =";
并将其替换为
$cfg['Servers'][$i]['password'] = 'Type your root password here';
这篇关于修复 phpMyAdmin 用户“root"@“localhost"拒绝访问的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!