連接mysql報錯 The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized

django使用mysql引擎連接mysql時報錯:

java.lang.RuntimeException: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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=GMT%2B8

全部url爲:jdbc:mysql://127.0.0.1:3306/blog?serverTimezone=GMT%2B8

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