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

|

|

The post discusses a common error faced by users after upgrading MariaDB database server on an Ubuntu platform – the ‘unix_socket’ is not loaded error. This prevents root user login. The post provides a tutorial to overcome this error by making changes in the MariaDB configuration file, enabling Unix socket authentication, and subsequent modifications to…

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 the MariaDB Plugin ‘unix_socket‘ is not loaded error. Whoa!

What’s the heck? I entered the root user’s correct password but couldn’t log on. So I quickly searched Google, and many help articles recommended bypassing MariaDB’s standard logon process and changing or resetting the root password.

This brief tutorial will 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, add a single line, and save. For example, 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 = auth_socket.so

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. It 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 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 turn off 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 can log on to the server with standard password authentication.

That’s it!

Like this:



8 responses to “How to fix MariaDB Plugin ‘unix_socket’ is not loaded on Ubuntu Linux”

  1. Kingsley Okei Avatar
    Kingsley Okei

    Awesome! You saved my life.

  2. fcncdn Avatar
    fcncdn

    You saved my life too!

  3. Marco Vazquez Avatar
    Marco Vazquez

    Thank you very much !! <3

  4. Arvid Avatar
    Arvid

    It worked perfectly! Thanks for sharing your experiences and the solution.

  5. Rodrigo Souza Avatar
    Rodrigo Souza

    Thank you!!!

  6. Dave Avatar
    Dave

    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.)

  7. Dave Avatar
    Dave

    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…

  8. Renzo Avatar
    Renzo

    Thank you very much!

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.