运行报错:
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone…..
错误原因:time zone 时区错误。

解决方式一
  1.在连接MySQL的 url后面加上时区:

   ?serverTimezone=GMT //或者UTC 注:GMT%2B8:中国时区UTC:国际标准时区

 

解决方式二
  1.使用root用户登录mysql
  2.查看时区:show variables like '%time_zone%';注:system_time_zone是值是SYSTEM(美国时间,中国要迟8小时)
  3.时区设置为当前系统时区即可,采用+8:00格式:set global time_zone='+8:00';

解决方式三
  1.修改mysql的my.cnf配置文件,在[mysql]下面添加: default-time-zone=’+08:00’


注:新版本的Driver不再使用com.mysql.jdbc.Driver,需要使用新的com.mysql.cj.jdbc.Driver
 

相关文章:

  • 2021-08-21
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-01-29
  • 2021-10-18
  • 2022-01-01
猜你喜欢
  • 2021-11-20
  • 2022-01-29
  • 2021-04-11
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
相关资源
相似解决方案