You are on page 1of 4

4/2/2018 How to Fix MariaDB Plugin 'unix_socket' is not loaded Error

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


June 9, 2016 Xiao Guo-An 5 Comments MariaDB

The Error “Plugin ‘unix_socket’ is not loaded” is commonly seen on Ubuntu 15.04/15.10/16.04 and any derivative
distributions such as Linux Mint 18. This tutorial shows how to fix it.

What is the Unix_Socket Plugin?

The Unix_Socket authentication plugin, which allows users to use OS credentials to connect to MariaDB via Unix
socket, is first supported in MariaDB 5.2.0. This plugin is not installed by default.

Log into MariaDB monitor.

mysql -u root -p

Then install the Unix_Socket plugin with this command:

MariaDB [(none)]>  install plugin unix_socket soname 'auth_socket';

My Ubuntu system has a user named linuxbabe , so I create a MariaDB user linuxbabe identified via the
unix_socket plugin.

MariaDB [(none)]> create user linuxbabe identified via unix_socket;

https://www.linuxbabe.com/mariadb/plugin-unix_socket-is-not-loaded-2 1/4
4/2/2018 How to Fix MariaDB Plugin 'unix_socket' is not loaded Error

Exit out of MariaDB monitor.

MariaDB [(none)]> quit

And now I can log into MariaDB monitor as user linuxbabe without typing password because I already logged into
Ubuntu system as linuxbabe.

That’s how Unix_Socket authentication plugin works.

Fix Plugin ‘unix_socket’ is not loaded Error

The Unix_Socket authentication plugin only works when your Linux OS and MariaDB have a user account with
the same username.

Your Linux OS has a root user. MariaDB also has a root user. So sometimes, when you try to log into MariaDB
monitor as root user, MariaDB may authenticate you via the Unix_Socket plugin but this plugin is not installed by
default. So you see Plugin 'unix_socket' is not loaded Error.

Another authentication plugin is mysql_native_password . MariaDB uses this plugin to authenticate a user
who is created with this command:

https://www.linuxbabe.com/mariadb/plugin-unix_socket-is-not-loaded-2 2/4
4/2/2018 How to Fix MariaDB Plugin 'unix_socket' is not loaded Error

create user demo_user@localhost identified by password 'secret_password';

To fix the above error, we can tell MariaDB to use mysql_native_password plugin to authenticate root user.

First stop MariaDB. If you have installed MariaDB from Ubuntu repository, use this command to stop it.

sudo systemctl stop mysql

If you have installed MariaDB from MariaDB repository, use the following command to stop it.

sudo systemctl stop mariadb

Then start MariaDB with  --skip-grant-tables option which bypass user authentication.

sudo mysqld_safe --skip-grant-tables &

Next, log into MariaDB monitor as root.

mysql -u root

Enter the following SQL statement to check which authentication plugin is used for root.

MariaDB [(none)]> select Host,User,plugin from mysql.user where User='roo


t';

https://www.linuxbabe.com/mariadb/plugin-unix_socket-is-not-loaded-2 3/4
4/2/2018 How to Fix MariaDB Plugin 'unix_socket' is not loaded Error

You might see it’s using unix_socket plugin. To change it to mysql_native_password plugin, execute this
command:

MariaDB [(none)]> update mysql.user set plugin='mysql_native_password';

If you forgot the MariaDB root user password, you can also change the root password now with the following
command:

MariaDB [(none)]> update mysql.user set password=PASSWORD("newpassword")


where User='root';

Exit MariaDB monitor.

flush privileges;
quit;

Stop mysqld_safe

sudo kill -9 $(pgrep mysql)

https://www.linuxbabe.com/mariadb/plugin-unix_socket-is-not-loaded-2 4/4

You might also like