Staying Current with Time Zone Changes
819
For information about time zone settings in replication setup, please see
Section 16.4.1, “Replication
Features and Issues”
.
10.6.1. Staying Current with Time Zone Changes
As mentioned earlier, when the time zone rules change, applications that use the old rules become
out of date. To stay current, it is necessary to make sure that your system uses current time zone
information is used. For MySQL, there are two factors to consider in staying current:
• The operating system time affects the value that the MySQL server uses for times if its time zone
is set to
SYSTEM
. Make sure that your operating system is using the latest time zone information.
For most operating systems, the latest update or service pack prepares your system for the time
changes. Check the Web site for your operating system vendor for an update that addresses the
time changes.
• If you replace the system's
/etc/localtime
timezone file with a version that uses rules differing
from those in effect at
mysqld
startup, you should restart
mysqld
so that it uses the updated rules.
Otherwise,
mysqld
might not notice when the system changes its time.
• If you use named time zones with MySQL, make sure that the time zone tables in the
mysql
database are up to date. If your system has its own zoneinfo database, you should reload the
MySQL time zone tables whenever the zoneinfo database is updated, using the instructions given
earlier in this section. For systems that do not have their own zoneinfo database, check the MySQL
Developer Zone for updates. When a new update is available, download it and use it to replace your
current time zone tables.
mysqld
caches time zone information that it looks up, so after replacing
the time zone tables, you should restart
mysqld
to make sure that it does not continue to serve
outdated time zone data.
If you are uncertain whether named time zones are available, for use either as the server's time zone
setting or by clients that set their own time zone, check whether your time zone tables are empty. The
following query determines whether the table that contains time zone names has any rows:
mysql>
SELECT COUNT(*) FROM mysql.time_zone_name;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
A count of zero indicates that the table is empty. In this case, no one can be using named time zones,
and you don't need to update the tables. A count greater than zero indicates that the table is not empty
and that its contents are available to be used for named time zone support. In this case, you should be
sure to reload your time zone tables so that anyone who uses named time zones will get correct query
results.
To check whether your MySQL installation is updated properly for a change in Daylight Saving Time
rules, use a test like the one following. The example uses values that are appropriate for the 2007 DST
1-hour change that occurs in the United States on March 11 at 2 a.m.
The test uses these two queries:
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central');
SELECT CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central');
The two time values indicate the times at which the DST change occurs, and the use of named time
zones requires that the time zone tables be used. The desired result is that both queries return the
same result (the input time, converted to the equivalent value in the 'US/Central' time zone).
Before updating the time zone tables, you would see an incorrect result like this:
mysql>
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central');
+------------------------------------------------------------+
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...