Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the incorrect time of Mysql5.7 error log

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The error log time of MySQL 5.7is inconsistent with the system time, which seems to be laborious. According to the official documents, log_timestamps parameter has been added since MySQL 5.7.2, which mainly controls the display time parameters of error log, genera log and other log files:

The official text is as follows:

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.

Permitted log_timestamps values are UTC (the default) and SYSTEM (local system time zone).

Timestamps are written using ISO 8601 / RFC 3339 format: YYYY-MM-DDThh:mm:ss.uuuuuu plus a tail value of Z signifying Zulu time (UTC) or ±hh:mm (an offset from UTC).

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.

After making the following changes, the display is normal:

Click (here) to collapse or open

(root@localhost) [(none)] > show global variables like 'log_timestamps'

+-+ +

| | Variable_name | Value |

+-+ +

| | log_timestamps | UTC |

+-+ +

1 row in set (0.01 sec)

(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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report