1.WARN: Establishing SSL connection without server's identity verification is not recommended
1.在數(shù)據(jù)庫連接的url中添加useSSL=false;2.url中添加useSSL=true偎谁,并且提供服務(wù)器的驗(yàn)證證書。如果只是做一個測試的話败富,沒必要搞證書那么麻煩啦肩榕,在連接后添加一個useSSL=false即可晒奕,例如:
jdbc:mysql://localhost:3306/test?useSSL=false
在使用Java進(jìn)行JDBC連接的時候,可以在Properties對象中設(shè)置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中時區(qū)問題
在jdbc連接的url后面加上?serverTimezone=GMT即可解決問題呻待。
(mysql8.X版本會出現(xiàn)這個問題)