Categories
SysOps

How to load time zone tables into MariaDB server

Load time zone tables into MariaDB server.

Determine if time_zone tables are loaded.

$ mariadb --skip-column-names --batch --execute "SELECT CONVERT_TZ('2021-04-21 13:00:00','GMT','Europe/Berlin') AS time;" --user root --password mysql
NULL

Load time_zone tables. Use this command to update these tables later.

$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mariadb --user root --password mysql
Enter password: ********
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.

Verify that time_zone tables are loaded.

$ mariadb --skip-column-names --batch --execute "SELECT CONVERT_TZ('2021-04-21 13:00:00','GMT','Europe/Berlin') AS time;" --user root --password mysql
2021-04-21 15:00:00