I recently encountered this error “ERROR 1524 (HY000): Plugin ‘unix_socket’ is not loaded” on my Debian 9 server while trying to authenticate to MariaDB database as a root user. After some googling, I found the workaround for this error is to start MySQL service with mysqld_safe and reset the root password.

Step 1: Stop mysql service

Stop MySQL service.

$ sudo systemctl stop mysql
# OR
$ sudo /etc/init.d/mysql stop

Step 2: Start mysql with mysqld_safe

Then start mysql service with mysqld_safe and option --skip-grant-tables and keep in running it the background.

$ sudo mysqld_safe --skip-grant-tables &
[1] 8197

Step 3: Reset root user password

Open MySQL terminal console.

$ sudo mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.14-MariaDB-1:10.3.14+maria~stretch mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

You should get to MySQL terminal without password authentication. Now switch to mysql database.

MariaDB [(none)]> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

Reset root user password.

MariaDB [mysql]> update user set password=PASSWORD("NewRootPassword") where User='root';
Query OK, 0 rows affected (0.002 sec)
Rows matched: 1 Changed: 0 Warnings: 0

Replace NewRootPassword with your new password for root user.

Also set Authentication plugin to native.

MariaDB [mysql]> UPDATE USER SET plugin="mysql_native_password";
Query OK, 2 rows affected (0.001 sec)
Rows matched: 2 Changed: 2 Warnings: 0

Close your Database session.

MariaDB [mysql]> quit;
Bye

Step 4: Start MySQL Service normally

Restart mysql service in a standard manner. But first stop the service.

$ sudo systemctl stop mysql
#OR
$ sudo /etc/init.d/mysql stop

Ensure no other process is running.

ps aux | grep mysql

Start mysql.

sudo systemctl start mysql

Test access as root user.

$ mysql -u root -p
Enter password: <Enter Password Set>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.14-MariaDB-1:10.3.14+maria~stretch mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> QUIT
Bye

Video Courses to help you Learn MySQL:

Similar articles.

How to reset MySQL root password

How to Reset RDS Master User Password on AWS

How to reset forgotten WordPress admin password

How to reset root password in RHEL / CentOS 8

How to Reset FreeIPA admin Password as root user

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here