设置全局时区
mysql> set global time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)
设置时区为东八区
mysql> set time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)
刷新权限使设置生效
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
查看验证
mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | |
| time_zone | +08:00 |
+------------------+--------+
2 rows in set, 1 warning (0.01 sec)