连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'[亲测有效]

连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'[亲测有效]今天在测试mysql 8.0 的时候,从远端连接到mysql发现了这样的一个问题 # mysql -h10.254.73.103 ERROR 2059 (HY000): Authentication…

连接 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
#

代码100分

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

连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'[亲测有效]

连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'[亲测有效]

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

下载

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

安装

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

查看client 库

代码100分# 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!

连接 mysql 报错 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password'[亲测有效]

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/7407.html

(0)
上一篇 2023-03-20
下一篇 2023-03-20

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注