由于Linux 默认时区是 CST ,而springboot 代码证中的默认时区不一致
一:在appliation.yml 文件中 的url 链接后 添加
&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.199.212:3306/CFMDCconfig_v2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
二:在启动类上 添加GMT 时区代码
//时差GMT TimeZone timeZone = TimeZone.getTimeZone("GMT+8"); TimeZone.setDefault(timeZone);
然后重启项目即可。