环境:
- centos7.0.3版本
- mysql5.7.30版本
mysql时间与centos7的时间相同,但是项目时间就是不一样
数据库时间查询;
select now()
mysql确认时区
show variables like "%time_zone%";
time_zone是 system 说明mysql使用system的时区,CST为东八区的时间会实际时间少13个小时
部署项目的时候可以直接在url的后面添加地区时间
&serverTimezone=Asia/Shanghai
具体的请看连接说明
url: jdbc:mysql://localhost:8080/netshop?zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
master:
url: jdbc:mysql://localhost:8080/netshop?zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
username: root
password: xxxxxxxx