java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than

MySQL时区问题

解决方案
1.更换成低版本的MYSQL的依赖;
2.这时候只要在MySQL连接数据库的url中加入?serverTimezone=UTC即可。

spring.datasource.url = jdbc:mysql://127.0.0.1:3306/markov_demo?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC


报错原因
SpringBoot整合MySQL的依赖包版本过高,在高版本的MySQL依赖中数据库和系统时区差异所造成的。系统为SQL默认美国时间,而我们中国要比他们迟8小时,因此将时区设置为当前系统时区即可,采用+8:00格式



posted @ 2020-06-11 16:15  木子娜拉  阅读(2114)  评论(0编辑  收藏  举报