Mysql – Disable thesql_tzinfo_to_sql during MariaDB/MySQL installation

datetimedockermariadbMySQLtimezone

MariaDB run in docker container hangs during initial startup while mysql_tzinfo_to_sql running because of the issue.

I've disabled mysql_tzinfo_to_sql by setting MYSQL_INITDB_SKIP_TZINFO env. var to 1.

Afterwards i manually ran:

mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | mysql -uuser -ppass --database=mysql

It takes ~12 minutes and script causes errors in MariaDB error log if MariaDB cluster is set.

I'm wondering what's the purpose of running mysql_tzinfo_to_sql during MariaDB installation and consequences of disabling it.

Found this link:

MySQL provides developers with a rich set of Date and Time functions.
One of the functions is CONVERT_TZ which converts a datetime value
from one time zone to another. This function can use named time zones
such as 'MET' or 'Europe/Moscow' from the time zone information tables
in system database called mysql.

Named time zones can be used only if the time zone information tables
in the mysql system database have been created and populated. The
MySQL installation procedure creates the time zone tables in the mysql
database, but does not load them with data. You need to load data
manually for these time zone tables.

It does answer the question.

However, i still don't fully understand practical implications of disabling populating mysql timezone system tables.

Why does timezone system tables population may take so long during initial MariaDB startup ?

Best Answer

Manual is pretty clear: loaded TZs enables a TZ-related functions. Say, with TZs loaded you can transform result's datetimes due to the client's TZ automatically, or calculate FROM_UNIXTIME() with respect to the leap seconds or daysaving times etc.