Access denied for user root'@'localhost

solrevdev profile image John Smith Originally published at solrevdev.com on ・1 min read

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? 🎉


Editor guide

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