MySQL Root Password Change and phpMyAdmin CodeUnit 15 JAN 2009

MySQL LogoBy default, most MySQL installations’ root user account starts with a blank password, a password set to nothing. Now when installing MySQL as part of a package like WAMPSever or XAMPP for example, other supporting services that are also being installed are automatically set up using that blank password. Still with me?

Say now you are a bit more security conscious than your average Joe and straight after installation you set your root user account password to a value, you shouldn’t be too surprised to find that all of a sudden your shiny new phpMyAdmin installation now coughs up blood and spits out the following error message:

#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

So why is this then? Well, like I mentioned above, it was installed using the default MySQL root installation password, the very password you have just now gone and changed. Thus it stands to reason that to fix this problem, one simply needs to edit phpMyAdmin’s config file.

And indeed, that is exactly what the solution is. Search for the phpMyAdmin installation folder and once found, navigate to the file and open it up with your favourite text editor.

Inside you will find two lines that look like this:

$cfg[‘Servers’][$i][‘user’] = ‘root’;
$cfg[‘Servers’][$i][‘password’] = ”;

As you can see the [‘password’] value is still set to ”, meaning that to fix your little problem, you simply need to insert your new root password into the empty space, meaning that those two lines should now look like:

$cfg[‘Servers’][$i][‘user’] = ‘root’;
$cfg[‘Servers’][$i][‘password’] = ‘NewRootPassword‘;

And there you go, phpMyAdmin should now be up and running once more, without all the unnecessary blood spitting.

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.