How to Fix MariaDB Plugin ‘unix_socket’ is not loaded Error on Ubuntu Linux

A couple of months ago I upgraded the MariaDB database server from 10.1 to 10.2 on my Ubuntu server without any problem. Everything worked without any issues. A few days ago, I decided to log on to the database to create a new blank database for a new WordPress.

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.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Then add the line below the [mysqld] section.

plugin-load-add =

After adding the line to the file, run the commands below to restart MariaDB

sudo systemctl restart mariadb.service

Next, try to sign on to the database again.

sudo mysql -u root

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.

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

Exit out and you’re done.

Now you should be able to log on to the server with standard password authentication.

That’s it!