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

I installed xampp,but when I tried to run it I got an error as thus:

Error

MySQL said: Documentation

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

Connection for controluser as defined in your configuration failed. 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.

I tried to search on internet for a solution, but I still can't fix my problem. I have already checked whether I used a password or not in config.inc.php file but i have not used any password.Also, when i try to access with a password, I still can't solve this problem.

I hope anyone can help me. .thank you


Solution 1:

I had this problem after changing the password for the root user in phpMyAdmin. I know nothing about programming but I solved it by doing the following:

  1. Go to file C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php (I guess you would replace "wamp" with the name of your server if you're not using Wamp Server)

  2. Find the line $cfg['Servers'][$i]['password']='' and change this to

    $cfg['Servers'][$i]['password']='NO'
    
  3. Try opening phpMyAdmin again, and hopefully the message will now read "Access denied for user 'root'@'localhost' (using password: YES)

  4. Now change the password in the above line to 'yourpassword' (whatever you had set it to before)

Hope this helps somebody.

Solution 2:

Go to the file C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php

Find the line $cfg['Servers'][$i]['password']='' and change it to

$cfg['Servers'][$i]['password']='root'

where root is the name of the password you had set in this instance

Hope this helps somebody.