使用最新版MySQL的jdbc驅動關於時區的異常

一、異常

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

<property name="url" value="jdbc:mysql://localhost:3306/yiibaijava?serverTimezone=GMT" />

因爲我在學習spring,故實在xml文件中修改,使用其它框架看情況修改就好

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