Skip to content

Instantly share code, notes, and snippets.

@Bachsau
Last active February 19, 2023 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bachsau/2ea86b71a26e0839d8eb048ce68968d1 to your computer and use it in GitHub Desktop.
Save Bachsau/2ea86b71a26e0839d8eb048ce68968d1 to your computer and use it in GitHub Desktop.
Single command to import system timezones into MySQL
#!/bin/sh -eu
if [ $(id -u) -ne 0 ]; then
echo 'Only root can do this' >&2
exit 1
fi
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql
mysql_tzinfo_to_sql --leap /etc/localtime | mysql mysql
systemctl restart mysql.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment