MySQL Access denied for user root

April 5, 2014 4.9k views
When I attempt to run: sudo mysql -uroot -p and enter my password, I am prompted with the following error message: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I've deleted and rebuilt my droplet twice now thinking I fat-fingered the password when I changed it using this command: sudo mysqladmin -u root -p'password' password mynewpassword I've tried the purge option from this page: https://help.ubuntu.com/community/MysqlPasswordReset but it must not be clearing the password as it fails to set the new password when I re-install mySQL. I also tried the reset a root password section from this page: https://www.digitalocean.com/community/articles/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql but when I run this command: sudo mysqld_safe --skip-grant-tables & it appears to hang. Any suggestions? Thanks, Justin
3 Answers
What about trying the command without the '

Thus doing this: sudo mysqladmin -u root -ppassword password mynewpassword
I guess the command:
sudo mysqld_safe --skip-grant-tables &
wasn't hanging.
I let it sit for about 20 minutes and it still appeared to be hung, but I pressed [Enter] and it returned me to my ~$ prompt. I continued with the instructions provided and was able to successfully reset the root password.

Guess I was just impatient?

Thanks,
Justin
Its possible but it also could have been a slow install as well. Anything is possible these days.
Have another answer? Share your knowledge.