Mysql5.7錯誤日志時間不對的解決辦法

 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.

創(chuàng)新互聯堅持“要么做到,要么別承諾”的工作理念,服務領域包括:網站建設、成都網站建設、企業(yè)官網、英文網站、手機端網站、網站推廣等服務,滿足客戶于互聯網時代的醴陵網站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯網解決方案。努力成為您成熟可靠的網絡建設合作伙伴!

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.

做了如下修改后,顯示正常了:

點擊(此處)折疊或打開

  1. (root@localhost) [(none)]> show global variables like 'log_timestamps';
  2. +----------------+-------+
  3. | Variable_name | Value |
  4. +----------------+-------+
  5. | log_timestamps | UTC |
  6. +----------------+-------+
  7. 1 row in set (0.01 sec)

  8. (root@localhost) [(none)]> set global log_timestamps=SYSTEM;
  9. Query OK, 0 rows affected (0.00 sec)

  10. (root@localhost) [(none)]> SHOW global variables like 'log_timestamps';
  11. +----------------+--------+
  12. | Variable_name | Value |
  13. +----------------+--------+
  14. | log_timestamps | SYSTEM |
  15. +----------------+--------+
  16. 1 row in set (0.01 sec)




名稱欄目:Mysql5.7錯誤日志時間不對的解決辦法
網頁路徑:http://bm7419.com/article18/jciigp.html

成都網站建設公司_創(chuàng)新互聯,為您提供外貿建站、品牌網站制作、品牌網站建設、自適應網站、網站排名

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

營銷型網站建設