报错信息:
java.sql.SQLException: 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.
根据百度搜索在配置文件中的“url”后面加上指定的时区,发现没有作用,后面问了大佬,说直接修改mysql的时区,问题得以解决
修改时区方法:
1:直接修改mysql配置文件信息 my.ini.cnf
在 [mysqld] 之下加上 default-time-zone = timezone 修改时区。
如修改成+8区: default-time-zone = '+8:00',修改完成后重启一下MySQL就OK了~
注意: 配置项要在[mysqld] 下加 ,否则会出现 unknown variable 'default-time-zone=+8:00'
2:通过命令 set global time_zone = '+8:00';修改,根据命令show variables like '%time_zone%';显示
显示修改成功