1

An Ubuntu 16.04 server has it's time zone set to America/New_York using the command

sudo timedatectl set-timezone America/New_York

This is confirmed by running the commands

timedatectl status | grep "Time zone"

 Time zone: America/New_York (EST, -0500)

date +%Z

EST

However MySQL thinks that the system's time zone is still UTC. MySQL 5.7 server (running within a docker container) has been restarted befpre querying for the MySQL timezone

Output of MySQL Query show global variables like '%time_zone'

system_time_zone UTC
time_zone SYSTEM

Did something go wrong?

1

You say you run mysql inside docker. Docker needs timezone as an environment variable as follows:

Add the following to mysql startup command in docker:

-e TZ='America/New_York' 

https://github.com/docker-library/mysql/issues/320

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.