Fix Access denied for user 'root'@'localhost' for 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.

If I go to 127.0.0.1/phpmyadmin , I do not get the error and everything works fine.

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.

Any ideas or how I can get this user's access back to normal without having to reinstall WAMP?


Find config.inc file under C:wampappsphpmyadmin3.5.1 Inside this file find this one line

$cfg['Servers'][$i]['password'] =";

and replace it with

$cfg['Servers'][$i]['password'] = 'Type your root password here';

我在更改数据库中的密码后遇到了同样的问题..我所做的是编辑更新后的密码,我之前更改过密码,并且我没有更新config.inc.php和D中相同的用户名: XAMP phpMyAdmin的 config.inc

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = **'root'**;
$cfg['Servers'][$i]['password'] = **'epufhy**';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

After I change the password for my "root" in phpMyAdmin page, I had a same problem and also looking for the solutions from the internet but fail to get the answer I needed, so I check the documentation inside the phpMyAdmin directory.

Go to and edit the file

modulesphpmyadmin414x140123114237config.sample.inc.php

look for line

$cfg['Servers'][$i]['auth_type'] = 'config'

and change the 'config' to 'http' and that will allow you to type the user name and password when you go to your phpMyAdmin page using your browser.

OR

see the documentation file under the same phpMyAdmin directory ( phpmyadmin414x140123114237dochtml ) for help and search for $cfg['Servers'][$i]['auth_type'] and you will see 4 options to choose from as to how to login to your phpMyAdmin page.

链接地址: http://www.djcxy.com/p/69298.html

上一篇: phpMyAdmin访问被拒绝错误

下一篇: 修复phpMyAdmin用户'root'@'localhost'拒绝访问