1.WARN: Establishing SSL connection without server's identity verification is not recommended
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) {
} ...
---------------------
2.mysql中时区问题
在jdbc连接的url后面加上?serverTimezone=GMT即可解决问题。
(mysql8.X版本会出现这个问题)