#1045 - Access denied for user 'root'@'localhost' (using password: YES)
Solution 1
The problem was I have 2 instances of Mysql installed and I didn't know the password for both instances.Just check if port 80 is used by any of the programs. This is what I did
1.Quit Skype because it was using port 80.(Please check if port 80 is used by any other program).
2.Search for Mysql services in task manager and stop it.
3.Now delete all the related mysql files.Make sure you delete all the files.
4.Reinstall
Solution 2
I first changed the root password running mysql at a prompt with
mysql -u root -p
Update password:
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
Edited line in the file config.inc.php
with the new root password:
$cfg['Servers'][$i]['password'] = 'MyNewPass'
Stop and re-start mysql service (in Windows: mysql_stop.bat
/mysql_start.bat
)
and got phpMyAdmin to work!
EDIT 2017: for MySQL≥5.7 use authentication_string
in place of Password
(see this answer):
UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
Solution 3
Well, there are many solutions already given above. If there are none of them works, maybe you should just try to reset your password again to 'root' as described here, and then reopen http://localhost/phpMyAdmin/
in other browser. At least this solution works for me.
Solution 4
This worked for me. In your config file
$cfg['Servers']['$i']['password'] = 'yourpassword';
In your mysql shell, login as root
mysql -u root
change your password or update if you've forgotten the old one
UPDATE mysql.user SET Password=PASSWORD('yourpassword') WHERE User='root';
stop and restart your mysql server from the xampp control panel. phpmyadmin can login to see your databases
Solution 5
Go to 'config.inc.php'. Write your password over here - $cfg['Servers'][$i]['password'] =''
Prakash
Updated on September 09, 2021Comments
-
Prakash over 2 years
This might seem redundant but I was unable to find a correct solution.
I was unable to login to mysql using the mysql console.It is asking for a password and I have no clue what I actually entered.(Is there a way to get the password or change it?) This is how my config.inc look.
When I try to open phpmyadmin I get this error(#1045 - Access denied for user 'root'@'localhost' (using password: YES))
<?php /* Servers configuration */ $i = 0; /* Server: localhost [1] */ $i++; $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'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'prakash123'; $cfg['Servers'][$i]['AllowNoPassword'] = true; /* End of servers configuration */ $cfg['DefaultLang'] = 'en-utf-8'; $cfg['ServerDefault'] = 1; $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; /* rajk - for blobstreaming */ $cfg['Servers'][$i]['bs_garbage_threshold'] = 50; $cfg['Servers'][$i]['bs_repository_threshold'] = '32M'; $cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600; $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M'; ?>
I have tried to uninstall( Plus Deleted all the related files) WAMP and reinstall.It didn't help either. While reinstalling WAMP server it is not asking for any username password stuff I don't know why. Any help is highly appreciated.