程序写入数据库时间不对,解决方法
mysql> show variables like '%time_zone%'; #查看时区
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | SYSTEM |
+------------------+--------+
2 rows in set (0.00 sec)
mysql> set global time_zone = '+08:00'; #设置全局时区
mysql> set time_zone = '+08:00'; #设置当前会话时区-退出后失效
mysql> flush privileges;
网友评论