MYSQL:WARN: Establishing SSL connection without server's identity verification is not recommended.

 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

是Mysql数据库的SSL链接问题,提示警告不建议使用没有带服务器身份验证的SSL链接,是在MYSQL5.5.45+, 5.6.26+ and 5.7.6+版本中才有的这个问题。解决办法在警告中已经说明了:sql

1.在数据库链接的url中添加useSSL=false;
2.url中添加useSSL=true,而且提供服务器的验证证书。
若是只是作一个测试的话,不必搞证书那么麻烦啦,在链接后添加一个useSSL=false便可,例如:数据库

jdbc:mysql://localhost:3306/test?useSSL=false
在使用Java进行JDBC链接的时候,能够在Properties对象中设置useSSL的值为false,可是和写在连接中是同样的。好比
 服务器

Properties properties = new Properties();
properties.setProperty("user", "root");
properties.setProperty("password", "milos23);
properties.setProperty("useSSL", "false");
properties.setProperty("autoReconnect", "true");
try (Connection conn = DriverManager.getConnection(connectionUrl, properties)) {
	...
} catch (SQLException e) {
	...
}
相关文章
相关标签/搜索