Skip to content

Conversation

@glensc
Copy link
Contributor

@glensc glensc commented Feb 10, 2021

Initializing a database with a config that specifies default-time-zone ends up with an error:

Fatal error: Illegal or unknown default time zone 'Europe/Tallinn'

This adds a workaround to the problem to force the system timezone (similarly to --initialize-insecure, --skip-networking options used in init db process), so the database can be initialized, and timezones be imported after database init.

Implements solution described at:

Why this is brought up again? It's because a config file offers a unified way to configure MySQL instance, compared to setting up environment variables for different systems (docker run, docker-compose, kubernetes, ...).


Local build commands:

git clone --depth 1 -b patch-1 https://github.com/glensc/docker-library-mysql mysql-pr739 && cd mysql-pr739
docker build 5.6 -t mysql:5.6_pr739 -f 5.6/Dockerfile.debian
docker build 5.7 -t mysql:5.7_pr739 -f 5.7/Dockerfile.debian
docker build 8.0 -t mysql:8.0_pr739 -f 8.0/Dockerfile.debian

Local test commands:

docker run --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:5.6_pr739 gosu mysql bash -x /entrypoint.sh mysqld --default-time-zone=Europe/Tallinn
docker run --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:5.7_pr739 gosu mysql bash -x /entrypoint.sh mysqld --default-time-zone=Europe/Tallinn
docker run --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:8.0_pr739 gosu mysql bash -x /entrypoint.sh mysqld --default-time-zone=Europe/Tallinn

@yannoff

This comment has been minimized.

@glensc

This comment has been minimized.

@glensc

This comment has been minimized.

Initializing database with a config that specifies `default-time-zone` ends up with an error:

> Fatal error: Illegal or unknown default time zone 'Europe/Tallinn'

This adds a workaround to the problem to force the system timezone, so the database can be initialized, and timezones be imported after database init.
@glensc glensc marked this pull request as ready for review February 10, 2021 22:52
@yannoff

This comment has been minimized.

@glensc

This comment has been minimized.

@yosifkit
Copy link
Member

Yeah, time zones are not available until after initialization, so this makes sense to add. CC @tianon & @ltangvald

I think alternatively they can set TZ, but it makes sense to support it in config files and flags too.

@yosifkit yosifkit requested review from ltangvald and tianon April 9, 2021 17:42
@tianon
Copy link
Member

tianon commented Apr 9, 2021

I don't love it, but it makes sense. 👍

@tianon tianon merged commit 43ee7da into docker-library:master Apr 9, 2021
@glensc glensc deleted the patch-1 branch April 9, 2021 20:20
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Apr 9, 2021
Changes:

- docker-library/mysql@43ee7da: Merge pull request docker-library/mysql#739 from glensc/patch-1
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Apr 19, 2021
Changes:

- docker-library/mysql@919d1ce: Update 8.0 to 8.0.24, debian 8.0.24-1debian10
- docker-library/mysql@b11f06b: Update 5.7 to 5.7.34, debian 5.7.34-1debian10
- docker-library/mysql@43ee7da: Merge pull request docker-library/mysql#739 from glensc/patch-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants