连接 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
#
于是乎,去搜索了一下,发现绝大多数都是从服务器修改,例如:
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!
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341