Mysql 中的SSL 连接

Mysql 中的SSL 连接

以下来自网络参考和自己测试整理,没有查找相关资料。若有错误之处,欢迎指正。

当前的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 只配置常规选项卡即可连接

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值