Created
September 3, 2019 12:44
-
-
Save asamofal/b460cf53eac374c889e827c740857107 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MySQL lets you specify which timezone to use in the my.cnf file, using the following config line: | |
default-time-zone=Europe/Oslo | |
However, you might find, after you do this, that it ends up failing to restart the service with the following error in the logs: | |
Fatal error: Illegal or unknown default time zone | |
Obviously Europe/London is a valid timezone name, so why does it not work? | |
Basically this error is caused when MySQL hasn't populated the timezone table within the mysql database, so it doesn't know what is or isn't a valid timezone name. | |
The way to fix this is, simply, to populate the timezone table, which can be done using the following command via ssh (You will need root access in mysql for this, and to have removed the line and gotten mysql back up and running of course): | |
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p | |
Pop in your mysql root password and wait for it to finish. Re-add the line to the my.cnf, restart the service and you should be all set! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment