mysql修改系统时区及日志显示时区(UTC改成北京时间)

上一篇 / 下一篇  2019-07-31 09:35:47 / 个人分类:mysql

1.修改系统时区:

mysql> show variables like "%time_zone%";
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | CST    |
| time_zone        | +08:00 |
+------------------+--------+
2 rows in set (0.00 sec) 

vi/etc/my.cnf ##在[mysqld]区域中加上
default-time_zone = '+8:00'

重启mysql


2.修改日志时区:
mysql> SHOW GLOBAL VARIABLES LIKE 'log_timestamps';
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| log_timestamps | UTC   |
+----------------+-------+
1 row in set (0.01 sec)

vi/etc/my.cnf ##在[mysqld]区域中加上
log_timestamps = SYSTEM


或者:
mysql> SET GLOBAL log_timestamps = SYSTEM;

mysql> SHOW GLOBAL VARIABLES LIKE 'log_timestamps';
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.00 sec)





TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar