MySQL 5.7非ssl连接数据库警告:WARN: Establishing SSL connection without server's identity verification is not recommended
原来使用jdbc连接数据库的地址:
jdbc:mysql://db.xxx.com:3036/mydb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
数据库升级到MySQL5.7后,连接数据库抛出警告:
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.
警告的大概意思是MySQL 5.5.45+,5.6.26+以及5.7.6+默认是开启ssl连接,不建议使用非ssl连接。
如果不需要使用ssl,可以设置
useSSL=false
在jdbc的mysql连接加上useSSL=false
jdbc:mysql://db.xxx.com:3036/mydb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false