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;
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:
create user [email protected] 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.
sudo systemctl stop mariadb or sudo systemctl stop mysql
sudo service mariadb stop or sudo service mysql stop
Then start MariaDB with –skip-grant-tables option which bypass user authentication.
sudo mysqld_safe --skip-grant-tables &
Then 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='root';
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;
sudo kill -9 $(pgrep mysql)
Start MariaDB again.
sudo systemctl start mariadb or sudo systemctl start mysql
sudo service mariadb start or sudo service mysql start
Now you can use normal password to login.
mysql -u root -p
I hope this article helped you to fix Plugin ‘unix_socket’ is not loaded error. Comments, questions or suggestions are always welcome. If you found this post useful, ? please share it with your friends on social media! Stay tuned for more tutorials.