MySQL5.7 error log时间显示问题
最近有两三套环境升级到了5.7.16,发现mysql.err中的时间好像有些问题,经查是mysql 5.7后的变更,如下:
root@localhost [(none)]>select now();
+---------------------+
| now() |
+---------------------+
| 2017-01-01 14:52:05 |
+---------------------+
1 row in set (0.00 sec)
日志显示时间
[root@bogon data]# /etc/init.d/mysqld start
Starting MySQL.... SUCCESS!
You have new mail in /var/spool/mail/root
[root@bogon data]# tailf error.log
2017-01-01T06:49:38.202954Z 0 [Note] InnoDB: Loading buffer pool(s) from /data/mysql/mysql3306/data/ib_buffer_pool
2017-01-01T06:49:38.440257Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-01T06:49:38.440314Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2017-01-01T06:49:38.440426Z 0 [Note] IPv6 is available.
2017-01-01T06:49:38.440443Z 0 [Note] - '::' resolves to '::';
2017-01-01T06:49:38.440471Z 0 [Note] Server socket created on IP: '::'.
2017-01-01T06:49:38.627893Z 0 [Note] InnoDB: Buffer pool(s) load completed at 161116 14:49:38
2017-01-01T06:49:38.871533Z 0 [Note] Event Scheduler: Loaded 0 events
2017-01-01T06:49:38.871938Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.14-log'socket: '/tmp/mysql3306.sock'port: 3306MySQL Community Server (GPL)
问题原因:
log_timestamps
Introduced 5.7.2
Command-Line Format --log_timestamps=#
System Variable Name log_timestamps
Variable Scope Global
Dynamic Variable Yes
Permitted Values Type enumeration
Default UTC
Valid Values UTC
SYSTEM
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.
这个参数是5.7.2引进来的,主要控制记录日志的时间戳(得加到默认配置中了),不影响general log和slow log写表。
解决办法:
它的默认设置是UTC,如果你想改变默认设置,set log_timestamps=SYSTEM就可以了。注意这个变量的作用域是global
root@localhost [(none)]>SHOW GLOBAL VARIABLES LIKE 'log_timestamps';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:3
Current database: *** NONE ***
+----------------+-------+
| 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.00 sec)
MySQL5.7 error log时间显示问题的更多相关文章
- Centos7 开机显示 ERST: Failed to get Error Log Address Range” 导致无法开机解决方法
开机显示 ERST: Failed to get Error Log Address Range” 导致无法开机,也无法重新安装系统,解决方法:开机进入BIOS , 关闭ACPI选项即可正常开机
- MySQL 5.7 时间显示修改(log_timestamps UTC)
https://blog.csdn.net/leshami/article/details/78952842 在MySQL 5.7版本中,日志记录时间发生了变化,使用了UTC方式来记录日志时间,也就是 ...
- 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo(转)
标签: 1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be c ...
- 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo
1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be consi ...
- Oracle归档日志所在目录时间不对&&Oracle集群日志时间显示错误
Oracle归档日志所在目录时间不对&&Oracle集群日志时间显示错误 前言 这个问题在18年的时候遇到了,基本不注意并且集群或者数据库运行正常是很难注意到的. 忘记当时怎么发现的了 ...
- MS SQL错误:SQL Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems
早晨宁波那边的IT人员打电话告知数据库无法访问了.其实我在早晨也发现Ignite监控下的宁波的数据库服务器出现了异常,但是当时正在检查查看其它服务器发过来的各类邮件,还没等到我去确认具体情 ...
- [控件]unigui移动端下Unidatepicker时间显示解决方案
[控件]unigui移动端下Unidatepicker时间显示解决方案 http://tz10000.com/kong-jian-unigui-yi-dong-duan-xia-unidatepick ...
- Trace & Error log in file
1. Log机制 做一些大型项目的时候,对代码的调试最有效的办法往往是最直接.最简单的log机制: 即对可以出设置打印店,对应打印信息进行调试(当然是有gdb也许你会觉得很高大上,但是实际项目中,gd ...
- vue element-ui表格里时间戳转换成时间显示
工作中遇到后台给的表格数据里时间是一个13位的时间戳,需要转换成时间显示在表格里, 可以用element-ui表格自带的:formatter函数,来格式化表格内容: // 时间戳转换成时间 // 使用 ...
随机推荐
- docker4dotnet #3 在macOS上使用Visual Studio Code和Docker开发asp.net core和mysql应用
.net猿遇到了小鲸鱼,觉得越来越兴奋.本来.net猿只是在透过家里那田子窗看外面的世界,但是看着海峡对岸的苹果园越来越茂盛,实在不想再去做一只宅猿了.于是,.net猿决定搭上小鲸鱼的渡轮到苹果园去看 ...
- slf4j
Simple Logging Facade for Java (SLF4J) slf4j可以看成是对各个日志框架的一种抽象,它提供了一套通用的日志使用接口. 下面是slf4j的几个版本比较: 1.6. ...
- Photoshop、Illustrator思维导图笔记
半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.
- 面向未来的友好设计:Future Friendly
一年前翻译了本文的一部分,最近终于翻译完成.虽然此设计思想的提出已经好几年了,但是还是觉得应该在国内推广一下,让大家知道“内容策略”,“移动优先”,“响应式设计”,“原子设计”等设计思想和技术的根源. ...
- lucene 基础知识点
部分知识点的梳理,参考<lucene实战>及网络资料 1.基本概念 lucence 可以认为分为两大组件: 1)索引组件 a.内容获取:即将原始的内容材料,可以是数据库.网站(爬虫).文本 ...
- JavaScript的妙与乐(一)之 函数优化
JavaScript的妙与乐系列文章主要是展示一些JavaScript上面比较好玩一点的特性和一些有用的技巧,里面很多内容都是我曾经在项目中使用过的一些内容(当然,未必所有技巧的使用频率都很高^_^) ...
- ASP.NET Web API Model-ValueProvider
ASP.NET Web API Model-ValueProvider 前言 前面一篇讲解了Model元数据,Model元数据是在Model绑定中很重要的一部分,只是Model绑定中涉及的知识点比较多 ...
- ABP(现代ASP.NET样板开发框架)系列之20、ABP展现层——动态生成WebApi
点这里进入ABP系列文章总目录 ABP(现代ASP.NET样板开发框架)系列之20.ABP展现层——动态生成WebApi ABP是“ASP.NET Boilerplate Project (ASP.N ...
- ABP源码分析十六:DTO的设计
IDTO:空接口,用于标注Dto对象. ComboboxItemDto:用于combobox/list中Item的DTO NameValueDto<T>/NameValueDto:用于na ...
- Android Studio 轻松整理字符串到string.xml中
昨天了解了Alt+Enter快捷键的大用处,今天又发现了一个快捷的方法,必须记下来.转载请注明出处http://www.cnblogs.com/LT5505/p/5466630.html 1.首先代码 ...