Skip to content

MySQL 5.7 :: TZ environment variable does not work #555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mih-kopylov opened this issue Mar 23, 2019 · 3 comments
Closed

MySQL 5.7 :: TZ environment variable does not work #555

mih-kopylov opened this issue Mar 23, 2019 · 3 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@mih-kopylov
Copy link

I'm working on Windows 10.

>docker version
Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:31 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     false
>docker run -it --rm mysql:5.7 date
Sat Mar 23 05:25:51 UTC 2019
>docker run -it --rm -e TZ='America/Los_Angeles' mysql:5.7 date
Sat Mar 23 05:26:09  2019

So it shows the same time for TZ='America/Los_Angeles' as for UTC, but does not show the time zone name.
It looks like timezone tables in MySQL are empty.

When I run docker run -it --rm -e MYSQL_ROOT_PASSWORD=1 mysql:5.7 mysql_tzinfo_to_sql /usr/share/zoneinfo it starts updating timezone tables with TZ details and gives huge log that ends with

,(@time_zone_id, 1932598827, 0)
,(@time_zone_id, 1950742827, 1)
,(@time_zone_id, 1964048427, 0)
,(@time_zone_id, 1982797227, 1)
,(@time_zone_id, 1995498027, 0)
,(@time_zone_id, 2014246827, 1)
,(@time_zone_id, 2026947627, 0)
,(@time_zone_id, 2045696427, 1)
,(@time_zone_id, 2058397227, 0)
,(@time_zone_id, 2077146027, 1)
,(@time_zone_id, 2090451627, 0)
,(@time_zone_id, 2108595627, 1)
,(@time_zone_id, 2121901227, 0)
,(@time_zone_id, 2140045227, 1)
;
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
 (@time_zone_id, 0, 3600, 1, 'WEST')
,(@time_zone_id, 1, 0, 0, 'WET')
;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('Y');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('right/Zulu', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
 (@time_zone_id, 0, 0, 0, 'UTC')
;
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
COMMIT;

I've noticed #320, but seems it doesn't work.

Is this a bug?
Or is there a way to start mysql:5.7 with timezone data already inserted?

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Mar 25, 2019
@wglambert
Copy link

Looks like an issue with Docker for Windows

$ docker run -it --rm mysql:5.7 date
Sat Mar 23 00:22:47 UTC 2019

$ docker run -it --rm -e TZ='America/Los_Angeles' mysql:5.7 date
Fri Mar 22 17:22:50 PDT 2019

This might work for you #543 (comment)

@tianon
Copy link
Member

tianon commented Apr 4, 2019

It could also be a corrupted image -- I'd suggest trying to remove all layers of the image and re-pulling and trying again.

In the future (and for further help debugging), I'd suggest trying the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@tianon tianon closed this as completed Apr 4, 2019
@mih-kopylov
Copy link
Author

Thanks, I've started using a default UTC time zone, so it's not actual for me any more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants