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    设置全球标准时间
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章