mysql和java读取时间相差14个小时的解决方案

检查数据库时间

SELECT now();

检查服务器时间

huanghaoyu@ubuntu:~/temp$ date

如果都没有错误,大概率是properties配置文件内的jdbc.url的链接问题,需要加上时区

jdbc.url = jdbc:mysql://localhost:3306/voj?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8

 

posted @ 2020-11-12 15:31  Mo-gujun  阅读(89)  评论(0编辑  收藏  举报