If your time zone setting is +08:00
means Beijing time, but our online servers are all UTC time, this difference will bring some unexpected results. Let's set the UTC time zone together!
MySQL root@(none):(none)> show variables like'%time_zone';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | +08:00 |
+------------------+--------+
2 rows in set
Time: 0.025s
step one:
Edit the /etc/my.cnf
file
cd /etc
sudo vim my.cnf
Step two:
Enter the following
[mysqld]
default-time-zone='+08:00'
Save and exit
Step three:
Restart mysql server
Step 4:
Log in to mysql server
, if it is the following, it will take effect
MySQL root@(none):(none)> show variables like'%time_zone';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | +00:00 |
+------------------+--------+
2 rows in set
Time: 0.025s
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。