You must configure either the server or JDBC driver (via the serverTimezone configuration property)

在連接字符串後面加上?serverTimezone=UTC

其中UTC是統一標準世界時間。

完整的連接字符串示例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC

或者還有另一種選擇:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8,這個是解決中文亂碼輸入問題,當然也可以和上面的一起結合:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

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