mysql icon indicating copy to clipboard operation
mysql copied to clipboard

log_timestamps=SYSTEM should be set

Open jianzhicangqiong opened this issue 3 years ago • 1 comments

I set the TZ='Asia/Shanghai' environment variable so that the time zone of the mysql container is cst, and the time of mysql is displayed as cst time, but the time in the mysql log is utc time. I hope that in the new version, the log time can be consistent with the system. .

jianzhicangqiong avatar Aug 03 '22 02:08 jianzhicangqiong

You could try a more involved way of setting the timezone https://github.com/docker-library/mysql/issues/543#issuecomment-467896467

https://github.com/docker-library/mysql/issues/543#issuecomment-471785639 But upstream explicitly documents the TZ environment variable as a sane and reasonable way to set the timezone for mysqld https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html

wglambert avatar Aug 05 '22 18:08 wglambert

@jianzhicangqiong 我也遇到了这个问题,然后找到了这个参数,需要配置一下就好了。 vim /usr/local/docker/mysql/config/mysqld.cnf

log_timestamps=SYSTEM

dofospider avatar May 18 '23 05:05 dofospider

You should be able to set that even easier via the container command:

$ docker run ... mysql:xxx --log-timestamps=SYSTEM

tianon avatar May 18 '23 22:05 tianon

Closing, as we do not intend to change the MySQL defaults in this way (and the workaround is really easy)

tianon avatar Dec 20 '23 00:12 tianon