content_image/786699.jpg
•Time Zone Variables 

•Populating the Time Zone Tables 

•Staying Current with Time Zone Changes 

•Time Zone Leap Second Support 

For information about time zone settings in replication setups, see Section 17.5.1.14, “Replication and System Functions”  and Section 17.5.1.33, “Replication and Time Zones” . 

## Time Zone Variables 

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 automatically and uses it to set the system_time_zone  system variable. The value does not change thereafter. 

To explicitly specify the system time zone for MySQL Server at startup, set the TZ  environment variable before you start mysqld . If you start the server using mysqld_safe , its --timezone  option provides another way to set the system time zone. The permissible values for TZ  and --timezone  are system dependent. Consult your operating system documentation to see what values are acceptable. 

•The server current time zone. The global time_zone  system variable indicates the time zone the server currently is operating in. The initial time_zone  value is ’SYSTEM’ , which indicates that the server time zone is the same as the system time zone. 

<img src='content_image/786699.jpg'>

## Note 

If set to SYSTEM , every MySQL function call that requires a time zone calculation makes a system library call to determine the current system time zone. This call may be protected by a global mutex, resulting in contention. 

The initial global server time zone value can be specified explicitly at startup with the --default- time-zone  option on the command line, or you can use the following line in an option file: 

default-time-zone=’ timezone ’ 

If you have the SYSTEM_VARIABLES_ADMIN  privilege (or the deprecated SUPER  privilege), you can set the global server time zone value at runtime with this statement: 

SET GLOBAL time_zone = timezone ; 

•Per-session time zones. Each client that connects has its own session time zone setting, given by the session time_zone  variable. Initially, the session variable takes its value from the global time_zone variable, but the client can change its own time zone with this statement: 

SET time_zone = timezone ; 

The session time zone setting affects display and storage of time values that are zone-sensitive. This includes the values displayed by functions such as NOW()  or CURTIME() , and values stored in and retrieved from TIMESTAMP  columns. Values for TIMESTAMP  columns are converted from the session time zone to UTC for storage, and from UTC to the session time zone for retrieval. 

The session time zone setting does not affect values displayed by functions such as UTC_TIMESTAMP() or values in DATE , TIME , or DATETIME  columns. Nor are values in those data types stored in UTC; the time zone applies for them only when converting from TIMESTAMP  values. If you want locale-specific 

