Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied for user 'root'@'localhost' with PHPMyAdmin

When I set the root password in PHPMyAdmin, I get this error:

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

I can't open the PHPMyAdmin panel. What am I doing wrong?

like image 661
Sam Avatar asked Jul 14 '12 10:07

Sam


People also ask

How do I fix MySQL error Access denied for user root localhost?

Use the ALTER USER command and change the authentication method to log into MySQL as root: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'insert_password'; This command changes the password for the user root and sets the authentication method to mysql_native_password.


2 Answers

Edit your phpmyadmin config.inc.php file and if you have Password, insert that in front of Password in following code:

$cfg['Servers'][$i]['verbose'] = 'localhost'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = '**your-root-username**'; $cfg['Servers'][$i]['password'] = '**root-password**'; $cfg['Servers'][$i]['AllowNoPassword'] = true; 
like image 67
Sathishkumar Avatar answered Sep 29 '22 20:09

Sathishkumar


Here are few steps that must be followed carefully

  1. First of all make sure that the WAMP server is running if it is not running, start the server.
  2. Enter the URL http://localhost/phpmyadmin/setup in address bar of your browser.
  3. Create a folder named config inside C:\wamp\apps\phpmyadmin, the folder inside apps may have different name like phpmyadmin3.2.0.1

  4. Return to your browser in phpmyadmin setup tab, and click New server.New server

  5. Change the authentication type to ‘cookie’ and leave the username and password field empty but if you change the authentication type to ‘config’ enter the password for username root.

  6. Click save save

  7. Again click save in configuration file option.
  8. Now navigate to the config folder. Inside the folder there will be a file named config.inc.php. Copy the file and paste it out of the folder (if the file with same name is already there then override it) and finally delete the folder.
  9. Now you are done. Try to connect the mysql server again and this time you won’t get any error. --credits Bibek Subedi
like image 40
Khadka Pushpendra Avatar answered Sep 29 '22 19:09

Khadka Pushpendra