ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Asked by Pat Shamblin

Yesterday I opened mysql like this: mysql -u root -p
Today it doesn't work, I don't get the mysql> prompt, instead I get:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
PioneerAxon (arth-svnit) said :
#1

Open this file with root rights
/etc/mysql/debian.cnf

Search for following lines

user = debian-sys-maint # you may find some different value, use your value
password = GPCzJs63iCz3w3Y8 # you will find some different value, use your value.

Login using this login id & password.

Now change root@localhost password by entering.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_password'); #change your_password with a new password.

exit mysql & log back in with
mysql -u root -p

Enter password you just reset.
You are done.

Revision history for this message
Peter Tavinor (ewe-loon) said :
#2

here is instructions for a complete Remove of Mysql
An important note for everyone, it is a total Remove that means Databases, passwords and user accounts, as well

http://stackoverflow.com/questions/10853004/removing-mysql-5-5-completely

you can change the 5.5 to 5.6 and 5.7 for other versions

Can you help with this problem?

Provide an answer of your own, or ask Pat Shamblin for more information if necessary.

To post a message you must log in.