Java出現The server time zone value ‘�й���׼ʱ��‘ is unrecogni的解決

錯誤
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 6.0以上都有這個問題)

 

修改:在url的字符串中添加 servertime=UTC

String url="jdbc:mysql://localhost:3306/school?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=UTC";

  • useUnicode=true  表示使用Unicode字符,因此可以使用中文
  • characterEncoding=utf8  設置編碼方式
  • useSSL=true   設置安全連接
  • serverTimezone=UTC    設置全球標準時間
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章