When I run the following command I get an error, however one of my scripts requires it.
SET time_zone = 'UTC';
ERROR 1298 (HY000): Unknown or incorrect time zone: 'UTC'
Simply run mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p
$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p
Enter password:
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
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.
Trivia: If you want to know what the HY00
stands for (a follow up I asked years later)....
As kaiser suggested, the trailing slash is unneeded but without specifying mysql as the database mariadb complains about a missing database. I found that
$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p -Dmysql
was the correct way to solve the problem in Mariadb 164.
In case you use MySQL on windows and get the error below
SET time_zone = 'UTC';
ERROR 1298 (HY000): Unknown or incorrect time zone: 'UTC'
From my post on how to resolve this issue:
The issue is you do not have the time zones data installed, to install the time zones on a Windows machine, you will need:
Download "timezone_2020a_posix.zip - POSIX standard" from https://dev.mysql.com/downloads/timezones.html
Stop the MySQL service
Extract the files from the downloaded file and copy them with overwrite to C:\ProgramData\MySQL\MySQL Server 5.6\data\mysql
Yes, to C:\ProgramData.. and not to C:\Program Files (x86)\MySQL...
Start the MySQL service