tidb修改时区

1、查看时间
MySQL [test]> SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2022-02-15 02:01:12 |
+---------------------+
1 row in set (0.00 sec)
 
MySQL [test]> select @@global.time_zone,@@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| SYSTEM | SYSTEM |
+--------------------+---------------------+
1 row in set (0.01 sec)
 
MySQL [test]> show global variables like '%time_zone';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | UTC |
| time_zone | SYSTEM |
+------------------+--------+
2 rows in set (0.00 sec)
 
2、设置成hongkong时间
 
 
MySQL [test]> set global time_zone="Asia/Hong_Kong";
Query OK, 0 rows affected (0.20 sec)
 
MySQL [test]> set time_zone="Asia/Hong_Kong";
Query OK, 0 rows affected (0.00 sec)
 
MySQL [test]> show global variables like '%time_zone';
+------------------+----------------+
| Variable_name | Value |
+------------------+----------------+
| system_time_zone | UTC |
| time_zone | Asia/Hong_Kong |
+------------------+----------------+
 
MySQL [test]> SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2022-02-15 10:05:57 |
+---------------------+
1 row in set (0.00 sec)

posted @ 2022-02-15 13:59  苍茫宇宙  阅读(356)  评论(0编辑  收藏  举报