MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded" MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded" linux linux

MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"


I got a solution!

When resetting root password at step 2), also change the auth plugin to mysql_native_password:

use mysql;update user set authentication_string=PASSWORD("") where User='root';update user set plugin="mysql_native_password" where User='root';  # THIS LINEflush privileges;quit;

This allowed me to log in successfully!


Full code solution

1. run bash commands

1. first, run these bash commands

sudo /etc/init.d/mysql stop # stop mysql servicesudo mysqld_safe --skip-grant-tables & # start mysql without password# enter -> gomysql -uroot # connect to mysql

2. then run mysql commands => copy paste this to cli manually

use mysql; # use mysql tableupdate user set authentication_string=PASSWORD("") where User='root'; # update password to nothingupdate user set plugin="mysql_native_password" where User='root'; # set password resolving to default mechanism for root userflush privileges;quit;

3. run more bash commands

sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start # reset mysql# try login to database, just press enter at password prompt because your password is now blankmysql -u root -p 

4. Socket issue (from your comments)

When you see a socket error, a community came with 2 possible solutions:

sudo mkdir -p /var/run/mysqld; sudo chown mysql /var/run/mysqldsudo mysqld_safe --skip-grant-tables &

(thanks to @Cerin)

Or

mkdir -p /var/run/mysqld && chown mysql:mysql /var/run/mysqld  

(thanks to @Peter Dvukhrechensky)


Blind paths and possible edge errors

Use 127.0.0.1 instead of localhost

mysql -uroot # "-hlocalhost" is default

Can lead to "missing file" or slt error.

mysql -uroot -h127.0.0.1

Works better.

Skip the socket issue

I've found many ways to create mysqld.sock file, change access rights or symlink it. It was not the issue after all.

Skip the my.cnf file

The issue also was not there. If you are not sure, this might help you.


You can try as follows it works for me.

Start server:

sudo service mysql start

Now, Go to sock folder:

cd /var/run

Back up the sock:

sudo cp -rp ./mysqld ./mysqld.bak

Stop server:

sudo service mysql stop

Restore the sock:

sudo mv ./mysqld.bak ./mysqld

Start mysqld_safe:

 sudo mysqld_safe --skip-grant-tables --skip-networking &

Init mysql shell:

 mysql -u root

Change password:

Hence, First choose the database

mysql> use mysql;

Now enter below two queries:

mysql> update user set authentication_string=password('123456') where user='root';mysql> update user set plugin="mysql_native_password" where User='root'; 

Now, everything will be ok.

mysql> flush privileges;mysql> quit;

For checking:

mysql -u root -p

done!

N.B, After login please change the password again from phpmyadmin

Now check hostname/phpmyadmin

Username: root

Password: 123456

For more details please check How to reset forgotten password phpmyadmin in Ubuntu


The mysql command by default uses UNIX sockets to connect to MySQL.

If you're using MariaDB, you need to load the Unix Socket Authentication Plugin on the server side.

You can do it by editing the [mysqld] configuration like this:

[mysqld]plugin-load-add = auth_socket.so

Depending on distribution, the config file is usually located at /etc/mysql/ or /usr/local/etc/mysql/