Knowledge Essentials - 3Essentials Hosting

MySQL Server Time Zone Support

Article ID: 235

 Back to Search

This article applies to MySQL 5.0 only.  Currently, 3Essentials installs MySQL 4.x on our shared hosting servers, and will only install MySQL 5.x on dedicated servers where the dedicated server customer has specifically requested MySQL 5.x.  As such, this article only applies to dedicated server customers with MySQL 5.x.

In MySQL 5.0, the 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 system_time_zone system variable.

  • The server's current time zone. The global time_zone system variable indicates the time zone the server currently is operating in. The initial value is 'SYSTEM', which indicates that the server time zone is the same as the system time zone. The initial value can be specified explicitly with the --default-time-zone=timezone option. If you have the SUPER privilege, you can set the global value at runtime with 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 variable. Initially this is the same as the global time_zone variable, but can be reset with this statement:

    mysql> SET time_zone = timezone;
    

The current values of the global and per-connection time zones can be retrieved like this:

mysql> SELECT @@global.time_zone, @@session.time_zone;

timezone values can be given as strings indicating an offset from UTC, such as '+10:00' or '-6:00'. If the time zone-related tables in the mysql database have been created and populated, you can also used named time zones, such as 'Europe/Helsinki', 'US/Eastern', or 'MET'. The value 'SYSTEM' indicates that the time zone should be the same as the system time zone. Time zone names are not case sensitive.

More information can be found at:

http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html

 
Downloads Associated With This Article
No downloads are currently associated with this article.