在对慢查询进行查看的时候发现时间不对,正好与系统时间相差8个小时。

1、慢查询显示时间如下

# Time: 2020-01-10T06:42:24.940811Z
$ dateFri Jan 10 14:42:31 CST 2020
mysql> show variables like 'log_timestamps';+----------------+-------+| Variable_name | Value |+----------------+-------+| log_timestamps | UTC  |+----------------+-------+1 row in set (0.00 sec)

log_timestamps

Property Value
Command-Line Format --log-timestamps=#
Introduced 5.7.2
System Variable log_timestamps
Scope Global
Dynamic Yes
Type Enumeration
Default Value UTC
Valid Values
UTC

SYSTEM

This variable controls the time zone of timestamps in messages written to the error log, and in 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).

修改参数就可以解决问题。

mysql> SET GLOBAL log_timestamps = SYSTEM;Query OK, 0 rows affected (0.00 sec)mysql> SHOW GLOBAL VARIABLES LIKE 'log_timestamps';+----------------+--------+| Variable_name | Value |+----------------+--------+| log_timestamps | SYSTEM |+----------------+--------+

更多相关文章

  1. MySQL系列多表连接查询92及99语法示例详解教程
  2. Android(安卓)- Manifest 文件 详解
  3. Android的Handler机制详解3_Looper.looper()不会卡死主线程
  4. Selector、shape详解(一)
  5. android2.2资源文件详解4--menu文件夹下的菜单定义
  6. Android发送短信方法实例详解
  7. Android(安卓)读取资源文件实例详解
  8. 详解Android中的屏幕方向
  9. Android学习笔记(10)————Android的Listview详解1(ArrayAdapte

随机推荐

  1. mvc项目01_感受mvc的风景_jQuery validat
  2. 使用jQuery验证的MVC Razor View不验证空
  3. jquery easyui window或者dialog没有关闭
  4. jQuery的DOM操作实例(3)——创建节点&&编写
  5. 如何检测用户有关退出页面的信息?
  6. jQuery入门(2) 获取元素和DOM转换
  7. php ajax成功:函数(msg) -获取msg
  8. Jquery对选取到的元素显示指定的长度,对于
  9. jQuery遍历祖先元素:parentsUntil
  10. 在可观察的内容中订阅