MySQL Time Zone Tables

From MythTV Official Wiki
Revision as of 15:40, 14 November 2013 by Llib (talk | contribs) (Add warning template, adjust for 0.27+)

Jump to: navigation, search

Starting with MythTV version 0.26, the time zone tables must be loaded in MySQL. This should be done before attempting the upgrade. mythtv-setup and mythbackend will not start without the tables loaded and an error message will apppear in the respective log explaining that.

This is important for users building from source, users loading MythTV from a package, for example Mythbuntu, should expect the tables to be loaded automatically.

To see if the tables are already loaded (using the same query that mythbackend/mythtv-setup uses to check them) start mysql and type:


If the response looks similar to this:

| 2013-11-14 14:07:58                    |

the tables are loaded and no further action is required.

Important.png Note: If the time zone tables are updated, then the procedure below should be repeated.

If the response looks like:

| NULL                                   |

then the tables must be loaded.

Assuming the distribution's time zone information is in /usr/share/zoneinfo, type:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p<yourpassword> mysql

Remove the -p<yourpassword> from the above if you don't have one.

Restart MySQL, and repeat the initial test.

Data too long for column 'Abbreviation' Error

Some users are getting the above message. The solution is to save the output of the 1st command in a file. Edit the file, search and delete all offending entries. Then cat that file to the 2nd command. Note that the bad entries could be on one line or be spread over several. Three line example:

INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'Local time zone must be set--see zic manual page')
mysql_tzinfo_to_sql /usr/share/zoneinfo > /tmp/tz.fix
edit /tmp/tz.fix
cat /tmp/tz.fix | mysql -u root -p<yourpassword> mysql

Missing UTC (0.26) or Etc/UTC (0.27+) Time Zone

It appears that some distributions do not contain information for the timezone that mythbackend and mythtv-setup check for before starting. In 0.27 and above the test is for: Etc/UTC', and in 0.26 it's: UTC.

Warning.png Warning: This fix is not supported. At least one user has reported success using it.

The 0.26 UTC entry can be added with the following (replace the two 'UTC' values with 'Etc/UTC' for 0.27+):

> mysql -u root -p mysql
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('UTC', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'UTC');
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;