Thursday, October 25, 2012

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

If you're using phpMyAdmin for the first time, you probably got this error
#1045 - Access denied for user 'root'@'localhost' (using password: NO)

The solution is
  1. open mysql command window and execute the following command to change the root password
    UPDATE mysql.user SET Password=PASSWORD('******') WHERE User='root';
    FLUSH PRIVILEGES;
    where ****** are your new password.
  2. open the config.inc.php file at C:\wamp\apps\phpmyadmin3.5.1 (This location may defer depending on the version and the location you installed wamp at)

    and edit the following line using a text editor
    $cfg['Servers'][$i]['password'] = '';
    to
    $cfg['Servers'][$i]['password'] = 'xxxxx';
    where xxxxx is the password of the root account of mysql.
  3.  Restart all wamp services and it should work.
Now, IT MAY NOT WORK!!
and it didn't work for me.
I uninstalled and reinstalled.
I restarted my machine.
but it still didn't work and if frustrated me.
and the solution was really simple.
I just deleted all my browser's history, and it finally WORKED!