Can't login to MySQL as root anymore?

Solution 1:

So you've gone from version 5.5.44-1ubuntu0.14.04.1 to 10.0.20-0ubuntu0.15.04.1. Sounds scarier than it is, that's just what they called 5.6 for some reason.

It seems that newer versions of MariaDB have added a plugin to the user table to force authentication through a fixed path. In this case, the root database user is forced through the unix_socket plugin. This also seems to be known as auth_socket in some circles.

Anyway this plugin restricts things so only the system root user can log in as the database root, with no password. It's a security choice they've made.

You can revert this by blanking the plugin field for the root user:

shell$ sudo mysql -u root

[mysql] use mysql;
[mysql] update user set plugin='' where User='root';
[mysql] flush privileges;

A specified password should work after this. I'm not sure how advisable this is though.