目录
一、报错信息
Thu Nov 21 21:51:17 GMT+08:00 2024 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.
二、原因
1. 报错原因简述
该警告提示您在建立与MySQL服务器的SSL连接时未进行服务器身份验证,这不符合MySQL的安全要求。MySQL 5.5.45+、5.6.26+ 和 5.7.6+ 版本默认要求使用SSL连接,除非显式设置。
2. 原因详细描述
默认SSL连接:从MySQL 5.5.45+、5.6.26+ 和 5.7.6+ 开始,默认情况下要求使用SSL连接。
未验证服务器身份:当前连接未进行服务器身份验证,这可能导致中间人攻击等安全问题。
verifyServerCertificate 属性:为了兼容旧应用,verifyServerCertificate 属性被设置为 false,但这不是推荐的做法。
三、解决方案
在database后面加上?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false参数把SSL关掉就好了
jdbc:mysql://localhost:3306/leadnews_user?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false