DEV Community

John Smith
John Smith

Posted on • Originally published at solrevdev.com on

Access denied for user root'@'localhost

Every time apt-get upgrade upgrades my local MySQL instance on my Ubuntu laptop I get the following error:

(1698, "Access denied for user 'root'@'localhost'")

The fix each time is the following, so here it is for me next time save me wasting time googling the error every time.

sudo mysql -u root

use mysql;

update user set plugin='mysql_native_password' where User='root';

flush privileges;

And with that all is well again!

Success? 🎉

Top comments (1)

Collapse
 
lpirir profile image
Luis Pirir

It's a good tip. Thank you for share.