14

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'
16

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)....

  • Could it be that the trailing slash is not really appreciated by mysql_tzinfo_to_sql? :) – kaiser Aug 1 '16 at 15:31
4

I would have added this as a comment to the accepted answer, but I lack the needed reputation. 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.

  • 1
    This appears to add some value to the thread. I gave you a +1 - I have an issue with the whole no comments till 50 policy. What you could do is flag your own "answer" as a comment - I think that's the recommended policy? There is a "barrier to entry" alright, but there's also a reason for it. – Vérace Apr 14 '19 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.