MySQL5.7新特性-log_timestamps参数

MySQL为了控制日志记录的时间显示方式,在5.7中新增了log_timestamps这个参数,默认为UTC。
这样导致MySQL日志记录里的时间比实际的慢,查看日志不方便。可以修改成SYSTEM解决问题。

root@localhost[(none)]> show variables like 'log_timestamps';
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| log_timestamps | UTC   |
+----------------+-------+
1 row in set (0.02 sec)
root@localhost[(none)]> SET GLOBAL log_timestamps = SYSTEM;
Query OK, 0 rows affected (0.01 sec)
root@localhost[(none)]> show variables like 'log_timestamps';
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.02 sec)
  • 官方说明:
  • This variable was added in MySQL 5.7.2. Before 5.7.2, timestamps in log messages were written using the local system time zone by default, not UTC. If you want the previous log message time zone default, set log_timestamps=SYSTEM.

    关于紫砂壶

    感悟技术人生
    此条目发表在MySQL分类目录,贴了标签。将固定链接加入收藏夹。