Setting the time zone for a Cloud Databases instance


You can set the server time zone for a Cloud Databases instance so that it is persistent by using the configuration groups feature of Cloud Databases. You can use either the Cloud Databases API or the trove command line tool to make the configuration changes. The examples in this article use the trove command line tool.

Prerequisites

If you want to use the trove command line tool and you do not already have it installed and set up, you need to do so. For instructions, see managing configuration groups using trove.

Setting the server time zone

The server time zone is set in MySQL in the default_time_zone parameter and the default value is SYSTEM. To set the default_time_zone to a different value you can use offsets of the time zone from UTC (Coordinated Universal Time). For example, the value for the Central Standard Time (CST) time zone would be "-6:00", and the value for the Australian Eastern Standard Time (AEST) time zone would be "+10:00".

You can set the default_time_zone parameter in a configuration group that can be applied to your Cloud Databases instance. You can create a new configuration group just for the time zone change or add the time zone parameter to an existing configuration group.

Note: You cannot apply named time zones such as Europe/Helsinki, US/Eastern.

Create a new configuration group

To create a new configuration group for custom time zone information, run the configuration-create command with trove.

The following example creates a configuration group named TimeConfig that sets the time zone to India Standard Time (IST):

trove configuration-create TimeConfig '{"default_time_zone":"+5:30"}' --datastore MySQL

To apply that configuration group to an existing Cloud Databases instance, run the configuration-attach command with trove, as follows:

trove configuration-attach TimeConfig aab79bba-9eaa-4ac3-94fc-e4aaf46b4efb

The last argument in that command is the instance ID. You can get a list of instances and their IDs by running the list command with trove.

trove list

Note: For the time zone setting to take effect, the Cloud Databases instance must be restarted.

Add to an existing configuration group

You can set the default_time_zone parameter can be set on an existing configuration group by running the configuration-patch command with trove.

The following example adds the India Standard Time (IST) time zone to a configuration group named ExistingConfig:

trove configuration-patch ExistingConfig '{"default_time_zone":"+5:30"}'

Note: For the time zone setting to take effect, the Cloud Databases instance must be restarted.

Checking the server time zone

You can check the current time zone setting for an instance by logging in to the mysql console and querying the value of global.time_zone parameter.

SELECT @@global.time_zone;

The returned value shows the instance's current time zone setting.

+--------------------+ | @@global.time_zone | +--------------------+ | +06:00             | +--------------------+

If the time zone does not reflect what you set in the configuration group attached to the instance, the instance might need to be restarted for the change to take effect.



Was this content helpful?




© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER