A week ago phpmyadmin was working fine but now whenever I try and access phpmyadmin, (in xampp localhost) it displays 2 error messages and nothing more. They are as follows:

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.


Cannot connect: invalid settings.

What I don't understand is that my other webpages can read the mysql databases fine but phpmyadmin cannot. I have checked the configuration file of phpmyadmin and everything seems to be normal. So has anybody had this problem or know how to solve it because I really need to be able to manage my databases for development reasons.

OK this usually happens when the root user or password for mysql was changed. your other pages can connect to mysql because nothing happened to the other mysql users. the user is usually root and you my or may not have have set a password for the user root.

navigate to where the phpmyadmin source files are on your computer. open the file (config.inc.php) and look for

($cfg[$i] = 'root'; // MySQL user)

make sure that the user is root or whatever username you may have set during the install of xampp or what ever username you may have recently changed to in mysql. and then look for

($cfg[$i] = ''; // MySQL password (only needed
// with 'config' auth_type))

if you used a password for the root user and you know what it is this is where it goes, in between the single quotes.

OMG - I just solved it. When I installed mediawiki under localhost, because mediawiki had full permissions, it changed my password. (before I had no password for root). And I soon discovered that it was actually only mediawiki that would work. So to find out my password, I just went into the mediawiki LocalSettings.php file and there the new password was.

I can't believe how this happened but from your reply I found the phpmyadmin settings to be the same as what I thought they should be and that is when I realised one of my cms's failed to load. Then I checked the other cms's I had and they all except mediawiki failed to access mysql. And it was only like 2 days ago I installed mediawiki and that is why I didn't notice the others to fail.
Thanks for the reply as I wouldn't have checked if you didn't post that.

*Solved*

Wait.. I have the same problem. I followed your instructions but it did not work.
Take a look at it...

$cfg[$i] = 'config';
$cfg[$i] = 'root';
$cfg[$i] = '';

This question has already been answered. Start a new discussion instead.