MySQL Access denied for user root

  • Posted April 5, 2014

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: 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: but when I run this command: sudo mysqld_safe --skip-grant-tables & it appears to hang.

Any suggestions? Thanks, Justin


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Its possible but it also could have been a slow install as well. Anything is possible these days.

I guess the command: <br>sudo mysqld_safe --skip-grant-tables & <br>wasn’t hanging. <br>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. <br> <br>Guess I was just impatient? <br> <br>Thanks, <br>Justin

What about trying the command without the ’ <br> <br>Thus doing this: sudo mysqladmin -u root -ppassword password mynewpassword