首页 > 代码库 > java运行jdk连接mysql出现了:Establishing SSL connection without server's identity verification is not recommended

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


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


在运行练习时出现下面的错误信息提示:

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连接。



技术分享

 

解决方案:在jdbc:mysql://localhost/table后面拼接?autoReconnect=true&useSSL=false
效果:
jdbc:mysql://localhost/table?autoReconnect=true&useSSL=false

然后重新运行一下,没有出现这类提示了。

技术分享

 

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