Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change time zone of error log file of MySQL?

Tags:

mysql

I have set time zone of MySQL in my.ini:
default_time_zone='+8:00'
but the time zone of log info in the /Data/**.err seems still to be '+0:00':
2016-02-01T02:40:49.087562Z 0 [Note] InnoDB: ……
actually it was 2016-02-01 10:40.
how can i change the time zone of log info in the error log file.
Thanks.

like image 774
xslzhk Avatar asked Feb 01 '16 04:02

xslzhk


2 Answers

In my.ini or my.cnf (according to your mysql configuration file) under [mysqld]

[mysqld]
log_timestamps = SYSTEM
like image 58
MTK Avatar answered Nov 15 '22 07:11

MTK


As of MySQL 5.7.2, the log_timestamps system variable controls the timestamp time zone of messages written to the error log (as well as to general query log and slow query log files). Permitted values are UTC (the default) and SYSTEM (local system time zone). Before MySQL 5.7.2, messages use the local system time zone

http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_timestamps

like image 30
Andrew Avatar answered Nov 15 '22 08:11

Andrew