項目在連接數據庫的時候出現這個警告⚠️
Fri Nov 09 16:47:08 CST 2018 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.
網上的解決方法:
jdbc.jdbcUrl=jdbc:mysql://localhost/blog?useSSL=true&useUnicode=true&characterEncoding=utf8
這個方法可用,但是我也出現了一些其他問題,記錄一下。
首先很感謝這位同學的博客https://www.cnblogs.com/junzi/p/6893122.html 找到了官方文檔的一個對照表
Summary of Connector/J Versions
Connector/J version | Driver Type | JDBC version | MySQL Server version | Status |
---|---|---|---|---|
5.1 | 4 | 3.0, 4.0, 4.1, 4.2 | 4.1, 5.0, 5.1, 5.5, 5.6, 5.7 | Recommended version |
5.0 | 4 | 3.0 | 4.1, 5.0 | Released version |
3.1 | 4 | 3.0 | 4.1, 5.0 | Obsolete |
3.0 | 4 | 3.0 | 3.x, 4.1 | Obsolete |
Summary of Connector/J Versions
Connector/J version | JDBC version | MySQL Server version | JRE Supported | JDK Required for Compilation | Status |
---|---|---|---|---|---|
6.0 | 4.2 | 5.5, 5.6, 5.7 | 1.8.x | 1.8.x | Developer Milestone |
5.1 | 3.0, 4.0, 4.1, 4.2 | 4.1, 5.0, 5.1, 5.5, 5.6*, 5.7* | 1.5.x, 1.6.x, 1.7.x, 1.8.x* | 1.5.x and 1.8.x | Recommended version |
得到了這個後,我回到我的pom文件:
我的mysql-connector-j 的版本是5.1.39
緊接着,我又查看了我的Linux上數據庫的版本
當然我的JDK版本是1.8
再看了我JDBC的版本
終於,根據表格,我的JDBC版本是 4.2 ,mysql 爲5.7 ,JDK是1.8
mysql-connector-java 的版本應該是選擇6.0
找到問題後,我修改了我的pom文件
問題得到了解決。
但是,事情沒有結束,這時候Druid連接池又報錯了
這個也是屬於版本的問題
mysql-connector-java6.0 與 druid 1.0.7 不兼容
原來的Druid
修改pom
問題解決了。