加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_泰州站长网 (http://www.0523zz.com/)- 视觉智能、AI应用、CDN、行业物联网、智能数字人!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

Mysql5.7错误日志时间不对的处理办法

发布时间:2022-04-06 11:47:55 所属栏目:MySql教程 来源:互联网
导读:MySQL 5.7的错误日志时间和系统时间不一致,看起来费劲,查阅官方文档得知从MySQL 5.7.2 开始,新增了 log_timestamps 参数,它主要是控制 error log、genera log等日志文件的显示时间参数: 官文如下: This variable controls the timestamp time zone of
        MySQL 5.7的错误日志时间和系统时间不一致,看起来费劲,查阅官方文档得知从MySQL 5.7.2 开始,新增了 log_timestamps 参数,它主要是控制 error log、genera log等日志文件的显示时间参数:
       官文如下:
       This variable controls the timestamp time zone of error log messages, and of general query log and slow query log messages written to files. It does not affect the time zone of general query log and slow query log messages written to tables (mysql.general_log, mysql.slow_log). Rows retrieved from those tables can be converted from the local system time zone to any desired time zone with CONVERT_TZ() or by setting the session time_zone system variable.
 
       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.
 
做了如下修改后,显示正常了:
 
(root@localhost) [(none)]> set global log_timestamps=SYSTEM;
Query OK, 0 rows affected (0.00 sec)
 
(root@localhost) [(none)]> SHOW global variables like 'log_timestamps';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.01 sec)
 

(编辑:云计算网_泰州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读