22 October 2008


phpMyAdmin Error - #1045 - Access denied for user 'root'@'localhost' (using password: NO)

Started getting this error after setting the "root" user password (see previous post).

Turns out that once you set the password on the "root" user the php script for phpMyAdmin can't get into the MySQL database (as there is now a password set that it doesn't know about).

To resolve this problem, you have to update a file named "config.inc.php" (found in phpMyAdmin installation directory - if you can't find it search for it using Windows Explorer, its there).

Once you have found the file, open it using Notepad (or a php editor if you're posh!)

Find: $cfg['Servers'][$i]['password']='';

(Note: there may be a few extra spaces in the above in your particular file, OR, you may already have an old password instead)

Change this with the current "root" user password (if you don't know this then ????)

It should look something like:

$cfg['Servers'][$i]['password']='the-root-user-password';

Save and close the file and try opening phpMyAdmin again and all should be fine (hopefully).
If it isn't then you may have entered the wrong password, check by manually logging into MySQL to verify the password:

Find the directory you installed MySQL into (usually c:\mysql)
Go into DOS prompt (Start -> Run -> type in cmd and press enter)
Go the the mysql installation directory
Go to the bin directory

Then type in:

mysql -u root -p

MySQL will respond with:

Enter password:


Type in the password (you used above) and press enter. If you get an error then you are using the wrong password. If you don't get an error then check other settings (ie. firewall, hosts file, MySQL service etc)

No comments: