How do I reflect time zone settings in MySQL on a Docker container?

Asked 1 years ago, Updated 1 years ago, 50 views

I have a question about MySQL time zone settings.
If you build or run using the Dockerfile below, the container will print an error and exit.


like loading timezone table information with the mysql_tzinfo_to_sql command I tried the method, but it didn't work (and it seemed like it was loaded).

Please let me know.

Dockerfile

 FROM mysql: 5.7

US>RUN
    echo' [mysqld]'; \
    echo' default-time-zone="Asia/Tokyo";\
} >/etc/mysql/conf.d/timezome.cnf

error message

Fatal error:Illegal or unknown default time zone

mysql docker

2022-09-30 19:30

1 Answers

I don't think there is a time zone called Asia/Tokyo in the MySQL time zone table.

Typically, create SQL to load using mysql-tzinfo-to-sql and load it with mysql.
MySQL::MySQL 5.6 Reference Manual::4.4.6 mysql_tzinfo_to_sql —Load Time Zone Table

 mysql_tzinfo_to_sql/usr/share/zoneinfo | mysql-u root mysql

I've never done it before, but there was an example of doing it with Docker in my home Stackoverflow.For your information.
Configure time zone to mysql docker container-Stack Overflow


2022-09-30 19:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.