Connection连接mysql数据库,报错内容:
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.
原因:未设置时区
解决:
方案1:使用数据库命令设置时区
查看mysql时区设置
执行sql命令:set global time_zone=’+8:00’;
方案2:连接数据库url添加serverTimezone=UTC
eg.jdbc:mysql://localhost:3306/zhzuz?serverTimezone=UTC;