spring boot 使用mysql数据库,启动的时候发现日志中有
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中默认要求使用ssl连接来访问数据库.
解决办法:
在jdbc url中加入useSSL参数(参数值可以为false,也可以为true),如下所示:
jdbc:mysql://localhost:3306/jsp_db?useSSL=false

本文介绍了解决SpringBoot应用连接MySQL时出现的SSL连接警告的方法。通过在JDBC URL中添加useSSL参数并设置其值为false或true,可以避免启动时出现关于未验证服务器身份的SSL连接警告。
507

被折叠的 条评论
为什么被折叠?



