背景介紹:
把項目在新的電腦上運行,MySQL版本不同出現錯誤
錯誤:
報錯The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must...
原因:
是使用了Mysql Connector/J 6.x以上的版本,然后就報了時區的錯誤
解決方法:
在配置url的時候不能簡單寫成 :
jdbc.url=jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf8&useSSL=false
改寫成 :
jdbc.url=jdbc:mysql://localhost:3306/demo?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false