原因: 中间某个环节的时区不对. 

 

我这里是mysql的时区不对.

 

解决办法: 全局修改时区设置. 可以通过修改配置文件, 但需要重启服务, 非常麻烦. 因此推荐使用命令行的方式.

1、查询当前系统时间

select now();

2、检查MySQL系统时区

show variables like '%time_zone%';

3、设置时区

set global time_zone = '+08:00'; // 修改mysql全局时区为北京时间,即我们所在的东8区
set time_zone = '+08:00'; // 修改当前会话时区

4、立即刷新生效

flush privileges;

原文链接: https://cloud.tencent.com/developer/article/2242859

posted on 2024-02-01 09:35  oLd-Y  阅读(30)  评论(0编辑  收藏  举报