Oracle 5.0 Reference Manual page 837

Table of Contents

Advertisement

The MySQL server maintains several time zone settings:
• The system time zone. When the server starts, it attempts to determine the time zone of the host
machine and uses it to set the
change thereafter.
You can set the system time zone for MySQL Server at startup with the
timezone=timezone_name
environment variable before you start mysqld. The permissible values for
are system dependent. Consult your operating system documentation to see what values are
TZ
acceptable.
• The server's current time zone. The global
zone the server currently is operating in. The initial value for
indicates that the server time zone is the same as the system time zone.
The initial global server time zone value can be specified explicitly at startup with the
time-zone=timezone
option file:
default-time-zone='timezone'
If you have the
SUPER
this statement:
mysql>
SET GLOBAL time_zone = timezone;
• Per-connection time zones. Each client that connects has its own time zone setting, given by the
session
time_zone
[500]
variable, but the client can change its own time zone with this statement:
time_zone
mysql>
SET time_zone = timezone;
The current session time zone setting affects display and storage of time values that are
zone-sensitive. This includes the values displayed by functions such as
[918], and values stored in and retrieved from
CURTIME()
columns are converted from the current time zone to UTC for storage, and from UTC to
TIMESTAMP
the current time zone for retrieval.
The current time zone setting does not affect values displayed by functions such as
[932]
UTC_TIMESTAMP()
data types stored in UTC; the time zone applies for them only when converting from
values. If you want locale-specific arithmetic for DATE, TIME, or
UTC, perform the arithmetic, and then convert back.
The current values of the global and client-specific time zones can be retrieved like this:
mysql>
SELECT @@global.time_zone, @@session.time_zone;
values can be given in several formats, none of which are case sensitive:
timezone
• The value
'SYSTEM'
• The value can be given as a string indicating an offset from UTC, such as
• The value can be given as a named time zone, such as 'Europe/Helsinki', 'US/Eastern',
or 'MET'. Named time zones can be used only if the time zone information tables in the
database have been created and populated.
The MySQL installation procedure creates the time zone tables in the
load them. You must do so manually using the following instructions. (If you are upgrading to MySQL
4.1.3 or later from an earlier version, you can create the tables by upgrading your
MySQL Server Time Zone Support
system_time_zone
[248]
option to mysqld_safe. You can also set it by setting the
time_zone
[406]
option on the command line, or you can use the following line in an
[578]
privilege, you can set the global server time zone value at runtime with
[500]
variable. Initially, the session variable takes its value from the global
or values in DATE, TIME, or
indicates that the time zone should be the same as the system time zone.
817
[498]
system variable. The value does not
--
--timezone
[500]
system variable indicates the time
[500]
time_zone
NOW()
columns. Values for
TIMESTAMP
columns. Nor are values in those
DATETIME
values, convert them to
DATETIME
'+10:00'
database, but does not
mysql
TZ
[248]
or
is 'SYSTEM', which
--default-
[926]
or
TIMESTAMP
or '-6:00'.
mysql
database.
mysql

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents