Recently, two or three sets of environments have been upgraded to 5.7.16, found that the time in the Mysql.err seems to have some problems, after the search is MySQL 5.7 changes, as follows:
[Email protected] [(None)]>select now ();
+---------------------+
| Now () |
+---------------------+
| 2017-01-01 14:52:05 |
+---------------------+
1 row in Set (0.00 sec)
Log display time
[[email protected] data]#/etc/init.d/mysqld start
Starting MySQL .... success!
You have new mail in/var/spool/mail/root
[Email protected] 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 no T 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)
Cause of the problem:
Log_timestamps
Introduced5.7.2
Command-Line format--log_timestamps=#
System Variablenamelog_timestamps
Variable Scopeglobal
Dynamic Variableyes
Permitted Valuestypeenumeration
Defaultutc
Valid VALUESUTC
SYSTEM
This variable controls the timestamp time zone of error log messages, and of the general query log and slow query log messages Written to files. It does not affect the time zone's general query log and slow query log messages written to tables (Mysql.general_log, my Sql.slow_log). Rows retrieved from those tables can is 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 is UTC (the default) and SYSTEM (local SYSTEM time zone).
Timestamps is 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 (a offset from UTC).
This variable is 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.
This parameter is introduced by 5.7.2, which mainly controls the timestamp of the log (which is added to the default configuration) and does not affect the general log and slow log writing table.
Workaround:
Its default setting is UTC, and if you want to change the default settings, set Log_timestamps=system is available. Note that the scope of this variable is global
[Email protected] [(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)
[Email protected] [(None)]>set global log_timestamps=system;
Query OK, 0 rows Affected (0.00 sec)
[Email protected] [(None)]>show GLOBAL VARIABLES like ' log_timestamps ';
+----------------+--------+
| variable_name| value|
+----------------+--------+
| Log_timestamps | SYSTEM |
+----------------+--------+
1 row in Set (0.00 sec)
MySQL5.7 error Log time display problem