Get back root MySQL access on Ubuntu

error: 'Access denied for user 'root'@'localhost'

Sound familiar? Using MySQL on Ubuntu you may have seen that once in a while. It can happen when you are using MySQL as the root user without a password, it doesn’t like that and “additional security” kicks in, shutting you out of the mysql shell. It is recommended to use a different user and a password, which makes a lot of sense anyway, but for local development it can be convenient to not do so. Here is what helps fixing this for me:

$ sudo mysql -u root
mysql> UPDATE mysql.user SET plugin='mysql_native_password';
mysql> FLUSH PRIVILEGES;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s