mysql时间显示错误,设置mysql时区

版权声明:本文为博主原创文章,未经博主允许不可转载。转载请注明出处 https://blog.csdn.net/qq_32442967/article/details/85264108

mysql显示时间问题 ,发现时间相差整整几个小时,需要设置mysql时区

方法一:
先登录mysql

1.查看mysql当前设置的时区:

show variables like '%time_zone%';

2.设置mysql时区

set GLOBAL time_zone = '+8:00';

重启mysql数据库


方法二: 在 /etc/my.cnf 文件中 [mysqld]区域 添加如下代码
default-time-zone = '+8:00'

重启mysql数据库


MySQL常用命令

猜你喜欢

转载自blog.csdn.net/qq_32442967/article/details/85264108