Fix MariaDB Plugin ‘unix_socket’ is not loaded Error on Ubuntu 17.04 | 17.10

Couple of months ago I upgraded MariaDB database server from 10.1 to 10.2 on my Ubuntu server without any problem… Everything worked without any issues… Few days ago, I decided to logon 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 logon.. I quickly searched Google and many of the help articles I came across were recommending to bypass MariaDB standard logon process and change or reset the root password… for students and new users, that process can be intimidating.

This brief tutorial is going to show students and new users how to quickly and easily fix MariaDB database server with 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:

Step 1: Add Unix Authentication plugin to MariaDB Config

If this issue relates to Unix authentication plugin, the quickest fix is to open MariaDB configuration file and add a single line into the file and save. Run the commands below to open MariaDB default configuration file.

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

Then add the line below [mysqld] section.

plugin-load-add = auth_socket.so

After adding the line into 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 logon onto the database without password prompt… that’s because it’s using unix socket authentication.

Step 2: Change to Standard Authentication

Step 1 should be enough to get you into 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

Exit out and you’re done. Now you should be able to logon to the server with standard password authentication.

That’s it!

You may also like the post below:

7 thoughts on “Fix MariaDB Plugin ‘unix_socket’ is not loaded Error on Ubuntu 17.04 | 17.10

  1. This did NOT work for me on Ubuntu 16.04.5 with Mariadb replacing Mysql … I can still only login at the command line after providing the password… Any tips? (Thanks for this how-to, in any case.)

  2. I managed to resolve my problem (by the way, I’m using MariaDB 10.3). The unix socket plugin is enabled by default. BUT you may also need to log into MariaDB (with your password, for instance) and then execute:

    ALTER USER root@localhost IDENTIFIED VIA unix_socket;

    In my case, the unix socket authentication was installed and enabled, but my root user was not configure to use it yet… Hope this helps some poor, frustrated soul in the future…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.