如何更改MySQL错误日志文件的时区?

[英]How to change time zone of error log file of 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.

我已经设置了MySQL的时区。ini: default_time_zone='+8:00',但日志信息在/Data/**中的时区。err似乎仍然是“+0:00”:2016-02-01T02:40:49.087562Z 0[注]InnoDB:……实际上是2016-02-01 10:40。如何在错误日志文件中更改日志信息的时区。谢谢。

3 个解决方案

#1


0  

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

在MySQL 5.7.2中,log_timestamp系统变量控制写入错误日志(以及一般查询日志和慢速查询日志文件)的消息的时间戳时区。允许的值是UTC(默认值)和SYSTEM(本地系统时区)。在MySQL 5.7.2之前,消息使用本地系统时区

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

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

#2


5  

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

在我的。ini或my.cnf(根据您的mysql配置文件)

[mysqld]
log_timestamps = SYSTEM

#3


-2  

set default timezone in your code.

在代码中设置默认时区。

date_default_timezone_set('America/Los_Angeles');

作用(美国/ Los_Angeles);

关注微信公众号

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/02/01/849d7296dc6d4666b567f6ba4d333d74.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com