5/29/2015

Change timezone from UTC with RDS instance


Here is how to change timezone setting in your RDS instance

1, connect your RDS instance as root.
[user@ec2 ~]$ mysql -u root -p -h xxxxxx.yyyyyy.zzzzzz.rds.amazonaws.com

2. Change the timezone setting.
mysql> DELIMITER |
mysql> CREATE PROCEDURE mysql.`set_PST`()
    -> IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN
    ->    SET SESSION time_zone = 'America/Los_Angeles';
    -> END IF |
mysql> DELIMITER ;

3. Create parameter group
find init_connect parameter and input 'CALL set_PST'. Then save changes.

4. Apply new parameter group to your RDS instance.

5. Log in to your RDS instance. Then submit the following command.

mysql> GRANT EXECUTE ON PROCEDURE mysql.set_PST TO 'username'@'hostname';


No comments: