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.
You may also like the post below: