专注于 JetBrains IDEA 全家桶,永久激活,教程
持续更新 PyCharm,IDEA,WebStorm,PhpStorm,DataGrip,RubyMine,CLion,AppCode 永久激活教程

连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'

今天在测试mysql 8.0 的时候,从远端连接到mysql发现了这样的一个问题

# mysql -h10.254.73.103
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
#

于是乎,去搜索了一下,发现绝大多数都是从服务器修改,例如:

79_1.png

79_2.png

what???到底是怎么肥事呢,我们接着来看看。

来,我们看看官网是怎么讲的?

The caching_sha2_password and sha256_password authentication plugins provide more secure password encryption than the mysql_native_password plugin, and caching_sha2_password provides better performance than sha256_password. Due to these superior security and performance characteristics of caching_sha2_password, it is as of MySQL 8.0 the preferred authentication plugin, and is also the default authentication plugin rather than mysql_native_password.

翻译过来就是

该caching_sha2_password和 sha256_password认证插件提供比更安全的密码加密 mysql_native_password插件,并 caching_sha2_password提供了比更好的性能sha256_password。由于的这些优越的安全性和性能 caching_sha2_password,它是MySQL 8.0的首选身份验证插件,也是默认的身份验证插件,而不是 mysql_native_password。

也就是mysql更新了这个特性,让密码更加安全,但是呢,这样调整,会引起客户端的连接问题,为了能够让客户端(库)连接上去,mysql 8.0 允许修改密码验证规则,让其从 caching_sha2_password 变更为 mysql_native_password ,不能说好,也不能说不好,看个人所需吧。

好了,了解了问题的始末,我们就可以解决问题了 上述是从服务器解决该问题,那么我们从客户端解决

下载资源库: https://dev.mysql.com/downloads/

根据自己的需要选择

这里选择的是 centos yum 的

机器型号: centos 7

下载

# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

安装

# yum install mysql80-community-release-el7-3.noarch.rpm

查看client 库

# yum list all | grep mysql | grep client
mysql-community-client.i686       8.0.21-1.el7           mysql80-community
mysql-community-client.x86_64     8.0.21-1.el7           mysql80-community
#

安装client

# yum install mysql-community-client -y

测试

# mysql -uroot -p123456 -h10.254.73.103
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> exit
Bye
#

Nice!

79_3.png

文章永久链接:https://tech.souyunku.com/19234

未经允许不得转载:搜云库技术团队 » 连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'

JetBrains 全家桶,激活、破解、教程

提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,支持 IntelliJ IDEA、PyCharm、WebStorm 等工具的永久激活。无论是破解教程,还是最新激活码,均可免费获得,帮助开发者解决常见激活问题,确保轻松破解并快速使用 JetBrains 软件。获取免费的破解补丁和激活码,快速解决激活难题,全面覆盖 2024/2025 版本!

联系我们联系我们