
Still, some users may wish to log in as MariaDB root without using sudo.
PWSAFE OPENS SLOWLY PASSWORD
And if you want to script some tedious database work, there is no need to store the root password in plain text for the script to use (no need for debian-sys-maint user). But not asking for a password means, there is no root password to forget (no need for the numerous tutorials on “how to reset MariaDB root password”).
PWSAFE OPENS SLOWLY FULL
It is based on a simple fact that asking the system root for a password adds no extra security - root has full access to all the data files and all process memory anyway. This technique was pioneered by Otto Kekäläinen in Debian MariaDB packages and has been successfully used in Debian since as early as MariaDB 10.0. Using unix_socket means that if you are the system root user, you can login as without a password. They are created as: CREATE USER root localhost IDENTIFIED VIA unix_socket OR mysql_native_password USING 'invalid' CREATE USER mysql localhost IDENTIFIED VIA unix_socket OR mysql_native_password USING 'invalid' Two all-powerful accounts are created by default - root and the OS user that owns the data directory, typically mysql. And installation scripts will no longer demand that you “PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !”, because the root account is securely created automatically.

However, an invalid password is initially set, so in order to authenticate this way, a password must be set with SET PASSWORD.

Second, if authentication fails with the unix_socket authentication plugin, then it is configured to try to use the mysql_native_password authentication plugin.


This allows the user to login without a password via the local Unix socket file defined by the socket system variable, as long as the login is attempted from a process owned by the operating system root user account.
