log_timestamps=SYSTEM should be set
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. .
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
@jianzhicangqiong 我也遇到了这个问题,然后找到了这个参数,需要配置一下就好了。 vim /usr/local/docker/mysql/config/mysqld.cnf
log_timestamps=SYSTEM
You should be able to set that even easier via the container command:
$ docker run ... mysql:xxx --log-timestamps=SYSTEM
Closing, as we do not intend to change the MySQL defaults in this way (and the workaround is really easy)