MySQL 失败:mysql“ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded" [英] MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"

查看:190
本文介绍了MySQL 失败:mysql“ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地环境是:

  • 全新的 Ubuntu 16.04
  • 使用 PHP 7
  • 已安装 MySQL 5.7

  • fresh Ubuntu 16.04
  • with PHP 7
  • with installed MySQL 5.7

sudo apt-get install mysql-common mysql-server

当我尝试登录 MySQL 时(通过 CLI):

When I tried to login to MySQL (via CLI):

mysql -u root -p

我遇到了一个包含 3 个步骤的循环问题.

I came across an cyclic issue with 3 steps.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

解决方案:重启电脑.

导致另一个错误:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'.

可能的问题?root"用户的密码错误!

Possible issue? Wrong password for "root" user!

解决方案:使用本教程重置root密码.

使用正确的密码和可用的套接字,最后一个错误出现.

With correct password and working socket, there comes last error.

mysql "ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded"

在这里我停了下来,或者以某种方式再次到达 1).

Here I stopped or somehow got to 1) again.

推荐答案

我有一个解决方案!

在步骤 2) 重置 root 密码时,还要将 auth 插件更改为 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 LINE

flush privileges;
quit;

这让我登录成功了!

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

2.然后运行mysql命令=>手动复制粘贴到cli

use mysql; # use mysql table
update user set authentication_string=PASSWORD("") where User='root'; # update password to nothing
update user set plugin="mysql_native_password" where User='root'; # set password resolving to default mechanism for root user

flush privileges;
quit;

3.运行更多 bash 命令

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 blank
mysql -u root -p 

4.套接字问题(来自您的评论)

当您看到 socket 错误时,社区提供了两种可能的解决方案:

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/mysqld
sudo mysqld_safe --skip-grant-tables &

(感谢@Cerin)

或者

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

(感谢@Peter Dvukhrechensky)

(thanks to @Peter Dvukhrechensky)

mysql -uroot # "-hlocalhost" is default

可能导致丢失文件"或 slt 错误.

Can lead to "missing file" or slt error.

mysql -uroot -h127.0.0.1

效果更好.

我找到了很多方法来创建 mysqld.sock 文件、更改访问权限或符号链接它.毕竟这不是问题.

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

问题也不存在.如果您不确定,这可能对您有所帮助.

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

这篇关于MySQL 失败:mysql“ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆