首页 > 其他分享 >ERROR 2026 (HY000): SSL connection error: protocol version mismatch

ERROR 2026 (HY000): SSL connection error: protocol version mismatch

时间:2023-01-09 15:13:37浏览次数:49  
标签:protocol ssl ERROR mismatch server SSL mysql 连接 etc

mysql 8 安装好连接数据库遇到错误:ERROR 2026 (HY000): SSL connection error: protocol version mismatch。

错误2026(hy000):SSL连接错误:协议版本不匹配
查询ssl配置
mysql> show variables like '%ssl%';
+---------------+----------------------------+
| Variable_name | Value |
+---------------+----------------------------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | /etc/mysql/ca-cert.pem |
| ssl_capath | |
| ssl_cert | /etc/mysql/server-cert.pem |
| ssl_cipher | |
| ssl_key | /etc/mysql/server-key.pem |
+---------------+----------------------------+
7 rows in set (0.00 sec)


解决办法:

第一种方法:在/etc/my.cnf配置文件里添加一行:skip_ssl,也可以直接在连接是使用

mysql -h10.233.117.225 -P3306 -uroot -p --skip-ssl

 

第二种办法:

mysql -h10.233.117.225 -P3306 -uroot -p --ssl-mode=DISABLED

这种方法是在mysql 8里比较推荐的方法。


参数–ssl-mode取值

DISABLED :与参数skip-ssl一样,不使用SSL/TLS建立加密连接
PREFERRED :优先尝试使用SSL/TLS建立加密连接,如果无法建立则尝试建立非SSL/TLS连接
REQUIRED :只会尝试使用SSL/TLS建立加密连接
VERIFY_CA: 与REQUIRED行为一样,与此同时会验证server端的证书是否有效
VERIFY_IDENTITY: 与VERIFY_CA行为一样,与此同时验证server端证书的host是否与实际连接的hostname一致


官方参考文档:

https://dev.mysql.com/doc/refman/8.0/en/connection-options.html#option_general_ssl-mode

标签:protocol,ssl,ERROR,mismatch,server,SSL,mysql,连接,etc
From: https://www.cnblogs.com/walkersss/p/17037086.html

相关文章