====== Accessing mysql root account in Ubuntu 18.04 ======
==== user root in MySQL ====
In Ubuntu 18.04 MySQL has been changed to allow the user root access only via ''sudo mysql -u root''. There is no passsword set for root and the simple access via mysql -u root is blocked by a authentification plugin in mysql:
sudo mysql -u root
mysql> use mysql
select user, host, authentication_string, plugin from user;
The result looks like:
+------------------+-----------+-------------------------------------------+-----------------------+
| user | host | authentication_string | plugin |
+------------------+-----------+-------------------------------------------+-----------------------+
| root | localhost | | auth_socket |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |
Ubuntuusers suggest to set up a second root account with all privileges. Because the remaining MySQL infrastructure relies on the root account with ''auth_socket'' plugin, this appears to be the better idea than to give the existing user root a password and replacing the plugin. See: https://kofler.info/root-login-problem-mit-mariadb/
==== MySQL script mysql_secure_installation ====
The script ''mysql_secure_installation'' can be used to set secure settings on your MySQL installation. But be careful, if you have chosen to use the password_validation_plugin for checking passwords, there is no easy way to reset the option. The levels 1 and 2 will require to set passwords with special characters what might not be what you want. Changing the level or disable the plugin must be set via the MySQL config files. The script will not allow to change the settings.