MySQL “无法加载身份验证插件‘caching_sha2_password’。找不到特定模块”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50342750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:56:13  来源:igfitidea点击:

"Authentication plugin 'caching_sha2_password' cannot be loaded. The specific module can not be found"

mysql

提问by aswin

Hey guys I am new to SQL and keep getting an error "Authentication plugin 'caching_sha2_password' cannot be loaded. The specific module can not be found" while connecting. enter image description here

嘿伙计们,我是 SQL 的新手,并且在连接时不断收到错误“无法加载身份验证插件‘caching_sha2_password’。找不到特定模块”。 在此处输入图片说明

回答by Sinan Eldem

  1. In your text editor of choice, open (or create) the /usr/local/etc/my.cnf file and add the following to the [mysqld]section of the file:

    default-authentication-plugin=mysql_native_password

  2. Open a terminal window, open an SSH session to your naked Mac Mini Server, and enter the following at the shell prompt:

    mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NEWPASSWORD';

  1. 在您选择的文本编辑器中,打开(或创建)/usr/local/etc/my.cnf 文件并将以下内容添加到该文件的[mysqld]部分:

    默认身份验证插件=mysql_native_password

  2. 打开终端窗口,打开与裸 Mac Mini 服务器的 SSH 会话,然后在 shell 提示符下输入以下内容:

    mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NEWPASSWORD';

Where NEWPASSWORDis the password you want to assign to the MySQL root user.

其中NEWPASSWORD是您要分配给 MySQL root 用户的密码。

  1. exit
  2. Reboot your Mac.
  1. 出口
  2. 重新启动您的 Mac。

Contents of this post is taken from farces.com

这篇文章的内容来自farces.com

回答by aswin

You have to "mysql_native_password" here to connect or else you have to configure "caching_sha2_password" plugin properly, as new MySQL comes with "caching_sha2_password" as below:

您必须在此处使用“mysql_native_password”进行连接,否则您必须正确配置“caching_sha2_password”插件,因为新 MySQL 带有“caching_sha2_password”,如下所示:

DROP USER 'your_user_name'@'localhost';
CREATE USER 'your_user_name'@'%' IDENTIFIED WITH mysql_native_password BY 'your_user_password';
GRANT ALL PRIVILEGES ON <db_name>.* TO 'your_user_name'@'%' identified by 'your_user_password';