连接mysql出现了:Establishing SSL connection without server's identity verification is not recommended

连接mysql出现了:Establishing SSL connection without server’s identity verification is not recommended

最近自己搭的一套代码评审工具(Fisheye+Crucible)总是出问题,查看日志,发现有一个WARN总是肆无忌惮的出现,黑压压的一片,对于有强迫症的我来说看着很不爽,于是决定kill it

注意:出现这类提示也不会影响对数据库的增删改查操作,所以不用紧张。。

详细的警告提示:

 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.

 翻译过来就是:不建议不使用服务器身份验证建立SSL连接,必须默认建立SSL连接。

解决办法如下,在与数据库建立连接的url后加上下面这段

?autoReconnect=true&useSSL=false

我原来的url是

jdbc:mysql://181.137.128.32:3306/fecru

加上后变成

jdbc:mysql://181.137.128.32:3306/fecru?autoReconnect=true&useSSL=false

重启工具,日志中黑压压的一堆,小事不见了,日志看着清爽多了…

 

    原文作者:小酉子说
    原文地址: https://www.jianshu.com/p/c841aa41cc96
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞