mysql error 1524-unix_socket

在登录MySQL时显示错误 mysql "ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded"

参考原文: https://askubuntu.com/questions/705458/ubuntu-15-10-mysql-error-1524-unix-socket

解决办法

/etc/init.d/mysql stop
sudo killall mysqld_safe
sudo killall mysqld
sudo mysqld_safe –skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD(“MySQL密码”) where User=’root’;
update user set plugin=”mysql_native_password“;
quit;
/etc/init.d/mysql stop
sudo kill -9 $(pgrep mysql)
/etc/init.d/mysql start

这是原文,挺详细的…

The “unix_socket” has been called by mysql authentication process (maybe related to a partial migration of database to mariadb, now removed). To get all stuff back working go su:

sudo su

then follow:

/etc/init.d/mysql stop
mysqld_safe –skip-grant-tables &
mysql -uroot

This will completely stop mysql, bypass user authentication (no password needed) and connect to mysql with user “root”.

Now, in mysql console, go using mysql administrative db:

use mysql;

To reset root password to mynewpassword (change it at your wish), just to be sure of it:

update user set password=PASSWORD(“mynewpassword”) where User=’root’;

And this one will overwrite authentication method, remove the unix_socket request (and everything else), restoring a normal and working password method:

update user set plugin=”mysql_native_password”;

Exit mysql console:

quit;

Stop and start everything related to mysql:

/etc/init.d/mysql stop
kill -9 $(pgrep mysql)
/etc/init.d/mysql start
Don’t forget to exit the su mode.

Now mySQL server is up and running. You can login it with root:

mysql -u root -p

or whatever you wish. Password usage is operative.

That’s it.


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!