mysql 使用問題以及解決辦法記錄

mysql隨着版本的升高,鏈接配置等問題也有所變動。

問題描述:

Sat Dec 21 16:32:32 CST 2019 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

翻譯結果:

警告:不建議在沒有服務器身份驗證的情況下建立SSL連接。根據MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果沒有設置顯式選項,則默認情況下必須建立SSL連接。您需要通過設置useSSL=false顯式禁用SSL,或者設置useSSL=true併爲服務器證書驗證提供信任存儲

解決辦法:

數據庫鏈接的url中添加useSSL=false或者true就可以了

問題描述:

Could not create connection to database server.

翻譯結果:無法創建到數據庫服務器的連接。

那是因爲本地安裝的mysql版本與項目中的mysql鏈接jar包版本不一致導致的。

解決方法:下載相對應的jar包就可以。

問題描述:

The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

服務器的時區價值”?й? ? ? ? ? ? ?未被識別或代表多個時區。如果您想利用時區支持,您必須配置服務器或JDBC驅動程序(通過serverTimezone配置屬性)來使用更具體的時區值。

解決辦法:

在jdbc連接的url後面加上serverTimezone=UTC或GMT就可以了

完整的jdbc url鏈接:jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8

 

mysql高版本的jdbc驅動鏈接也有所改變,之前的鏈接爲db.driver=com.mysql.jdbc.Driver 高版本的變爲com.mysql.cj.jdbc.Driver

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章