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!
Leave a Reply Cancel reply