After running the standard sudo mysql -u root -p commands to gain access, I was met with MariaDB Plugin ‘unix_socket’ is not loaded error. whoa! What’s the heck? I’m entering the correct password for the root user but couldn’t log on. I quickly searched Google and many of the help articles I came across were recommending to bypass MariaDB’s standard logon process and changing or resetting the root password. This brief tutorial is going to show students and new users how to quickly and easily fix the MariaDB database server with the unix_socket is not loaded error. There might be other methods out there that work. however, a quick fix might be just following the steps below:

Add Unix Authentication plugin to MariaDB Config

If this issue relates to the Unix authentication plugin, the quickest fix is to open the MariaDB configuration file and add a single line to the file and save. Run the commands below to open the MariaDB default configuration file. Then add the line below the [mysqld] section. After adding the line to the file, run the commands below to restart MariaDB Next, try to sign on to the database again. Running the commands above should log on to the database without a password prompt. that’s because it’s using Unix socket authentication.

Change to Standard Authentication

Step 1 should be enough to get you into the MariaDB server. and should work as long as you keep using Unix socket authentication. However, other apps and services like phpMyAdmin that depend on standard password authentication will stop working when you enable socket authentication for the root user. A typical error you’ll get when Unix socket authentication is being used will be  ERROR 1698 (28000): Access denied for user ‘root’@’localhost’ So now that you’ve access to the database, run the commands below to disable Unix socket authentication for the root user. Exit out and you’re done. Now you should be able to log on to the server with standard password authentication. That’s it!