MySQL失败:mysql“错误1524(HY000):未加载插件'auth_socket'" [英] MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"

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

问题描述

我的本​​地环境是:

  • 新鲜的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

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

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'

解决方案:重新启动PC.

这导致了另一个错误:

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

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

Possible issue? Wrong password for "root" user!

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

Solution: reset root password with this tutorial.

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

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:

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 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“错误1524(HY000):未加载插件'auth_socket'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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