關於JDBC 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”配置屬性)來使用更特殊的時區值。

就是說是因爲數據庫時區與系統時區有差異導致的
怎麼解決呢?
在url後部加上serverTimezone=UTC
如下

jdbc:mysql://localhost:3306/course?serverTimezone=UTC
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章