Report this

What is the reason for this report?

MySQL Access denied for user root

Posted on 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: 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



This textbox defaults to using Markdown to format your 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.

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

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

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.