MySQL 5.7的錯誤日志時(shí)間和系統(tǒng)時(shí)間不一致,看起來費(fèi)勁,查閱官方文檔得知從MySQL 5.7.2 開始,新增了 log_timestamps 參數(shù),它主要是控制 error log、genera log等日志文件的顯示時(shí)間參數(shù):
官文如下:
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.
做了如下修改后,顯示正常了:
點(diǎn)擊(此處)折疊或打開