当前的Mysql 客户端版本基本都不太能支持 caching_sha2_password 认证,使用Mysql 8.0 的话,建议添加参数:
default-authentication-plugin=mysql_native_password
否则可能导致客户端连接失败。以下的案例也是基于此。客户端的不支持会导致不能反映真实结果。
当前数据库中的用户
root@(none):53: >select host,user,ssl_type,ssl_cipher,x509_issuer,x509_subject,plugin from mysql.user;
+--------------+------------------+----------+------------+-------------+--------------+-----------------------+
| host | user | ssl_type | ssl_cipher | x509_issuer | x509_subject | plugin |
+--------------+------------------+----------+------------+-------------+--------------+-----------------------+
| % | rep | | | | | mysql_native_password |
| % | root | | | | | mysql_native_password |
| % | test | | | | | mysql_native_password |
| % | test1 | | | | | caching_sha2_password |
| 192.168.20.% | cat | X509 | | | | mysql_native_password |
| localhost | mysql.infoschema | | | | | caching_sha2_password |
| localhost | mysql.session | | | | | caching_sha2_password |
| localhost | mysql.sys | | | | | caching_sha2_password |
| localhost | root | | | | | caching_sha2_password |
+--------------+------------------+----------+------------+-------------+--------------+-----------------------+
10 rows in set (0.00 sec)
require_secure_transport = OFF 模式
此为默认设置,该模式下用户可以不通过ssl加密连接到数据库
-- 不通过SSL连接方式
mysql -h mysql1 -utest -ptest --ssl-mode=DISABLED
SSL: Not in use
-- 通过SSL连接方式
mysql -h mysql1 -utest -ptest
mysql -h mysql1 -utest -ptest --ssl-mode=PREFERRED
mysql -h mysql1 -utest1 -ptest1 --ssl-mode=PREFERRED
mysql -h mysql1 -utest1 -ptest1 --ssl-mode=REQUIRED
SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256
navicate 只配置常规选项卡即可连接
连