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函数,来格式化表格内容: // 时间戳转换成时间 // 使用 ...
随机推荐
- MySQL: Fabric 搭建 HA
搭建好Fabric之后,就可以在它的基础上创建HA Group. Shard Group.HA+Shard Group等.这里来说明一下如何快速的搭建HA环境. Fabric 192.168.2.23 ...
- SQLServer2005创建定时作业任务
SQLServer定时作业任务:即数据库自动按照定时执行的作业任务,具有周期性不需要人工干预的特点 创建步骤:(使用最高权限的账户登录--sa) 一.启动SQL Server代理(SQL Server ...
- Oracle使用触发器和mysql中使用触发器的比较——学习笔记
一.触发器 1.触发器在数据库里以独立的对象存储, 2.触发器不需要调用,它由一个事件来触发运行 3.触发器不能接收参数 --触发器的应用 举个例子:校内网.开心网.facebook,当你发一个日志, ...
- Java集合---ConcurrentHashMap原理分析
集合是编程中最常用的数据结构.而谈到并发,几乎总是离不开集合这类高级数据结构的支持.比如两个线程需要同时访问一个中间临界区(Queue),比如常会用缓存作为外部文件的副本(HashMap).这篇文章主 ...
- 【腾讯Bugly干货分享】一步一步实现Android的MVP框架
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/5799d7844bef22a823b3ad44 内容大纲: Android 开发 ...
- Unity3D新手引导开发手记
最近开始接手新手引导的开发,记录下这块相关的心得 首先客户端是Unity,在接手前,前面的同学已经初步完成了新手引导框架的搭建,这套框架比较简单,有优点也有缺点,稍后一一点评 我们的新手引导是由一个个 ...
- wp已死,metro是罪魁祸首!
1.这篇文章肯定会有类似这样的评论:“我就是喜欢wp,我就是喜欢metro,我就是软粉“等类似的信仰论者发表的评论. 2.2014年我写过一篇文章,windows phone如何才能在中国翻身? 我现 ...
- 在ASP.NET MVC5中实现具有服务器端过滤、排序和分页的GridView
背景 在前一篇文章<[初学者指南]在ASP.NET MVC 5中创建GridView>中,我们学习了如何在 ASP.NET MVC 中实现 GridView,类似于 ASP.NET web ...
- ABP文档 - Web Api 控制器
文档目录 本节内容: 简介 AbpApiController 基类 本地化 其它 过滤 审计日志 授权 防伪造过滤 工作单元 结果包装和异常处理 结果缓存 验证 模块绑定器 简介 通过Abp.Web. ...
- Failed to stop iptables.service: Unit iptables.service not loaded.
redhat 7 [root@lk0 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service Fai ...