mysql8.0 关闭ssl连接_mysql 8.0.12 SSL异常排查

在使用MySQL 8.0.12时遇到SSL连接异常,由于默认SSL开启,导致应用程序无法正常运行。排查过程包括检查MySQL版本、数据库驱动、SSL状态,并尝试在数据库连接URL中设置`userSSL=true`关闭SSL。注意,关闭SSL可能不符合安全性最佳实践,建议根据需求配置SSL验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

WARN: Establishing SSL connection without server's identity verification is not recommended.

According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set.

For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'.

You need either to explicitly disable SSL by setting useSSL=false,or set useSSL=true and provide truststore for server certificate verification.

今天玩kafka监控的时候,以前的项目突然跑不起来了,折腾了几个小时排查清楚。

原因是mysql的SSL默认开启的,而且mysql8.0.12版本的驱动也和mysql5.2.23左右版本(我以前用的版本)的不一样。画

我的排查步骤基本如下:

1.检查项目引用的mysql版本及本地maven库相同版本是否存在;

c51427b86ce741de51506aa70d70b02d.png

2.检查数据库驱动,我现在8.0.12本版本

com.mysql.cj.jdbc.Driver

kafka.eagle.driver=com.mysql.cj.jdbc.Driver

3.查询SSL的状态

have_openssl=YES,即SSL是开启的,有需要的同学可以搜一下如何通过mysql配置文件关闭SSL(因为我没有关闭成功,所以在这里不展示具体步骤)。

mysql> SHOW VARIABLES LIKE '%ssl%';

+---------------+-----------------+

| Variable_name | Value |

+---------------+-----------------+

| have_openssl | YES |

| have_ssl | YES |

| ssl_ca | ca.pem |

| ssl_capath | |

| ssl_cert | server-cert.pem |

| ssl_cipher | |

| ssl_crl | |

| ssl_crlpath | |

| ssl_key | server-key.pem |

+---------------+-----------------+

4.关闭SSL,在数据库连接url中要添加关闭SSL的参数userSSL=true

kafka.eagle.url = jdbc:mysql://localhost/ke?userSSL=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT

参考文章来源:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值