【錯誤處理】【MySQL】The server time zone value '' is unrecognized or represents more than one time zone.

錯誤描述:

MySQL連接數據庫時提示系統時區出現錯誤
java.sql.SQLException: 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.

解決辦法:

在數據庫驅動的url後加上serverTimezone=UTC參數。

  1. 如果該參數是’?'後的第一個,應寫爲
    url = "jdbc:mysql://127.0.0.1:3306/database_name?serverTimezone=UTC"
  2. 如果該參數不是’?'後的第一個,應寫爲
    url = "jdbc:mysql://127.0.0.1:3306/database_name?characterEncoding=utf8;serverTimezone=UTC"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章