{"id":14027,"date":"2014-05-31T23:59:20","date_gmt":"2014-05-31T18:29:20","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=14027"},"modified":"2014-05-31T23:59:20","modified_gmt":"2014-05-31T18:29:20","slug":"change-mysql-timezone-on-amazon-rds","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/change-mysql-timezone-on-amazon-rds\/","title":{"rendered":"Change MySQL Timezone on Amazon RDS"},"content":{"rendered":"<p>Amazon RDS doesn&#8217;t allow you to change timezone, It keeps same UTC time zone across\u00a0all regions.\u00a0<strong>time_zone <\/strong>variable in<strong>\u00a0<\/strong>the\u00a0parameter group is read only.<\/p>\n<p>You can change the time zone on each connection or session by making a procedure in default mysql database and call this function on each init connection.<\/p>\n<p>1. \u00a0 \u00a0Create a procedure for IST<\/p>\n<pre style=\"padding-left: 30px\">DELIMITER |\r\n     CREATEPROCEDURE mysql.rds_store_time_zone ()\r\n        IFNOT(POSITION('rdsadmin@'INCURRENT_USER())=1)THEN\r\n           SET SESSION time_zone ='+5:30';\r\n        ENDIF\r\n|\r\nDELIMITER ;<\/pre>\n<p>2. \u00a0 Update parameter group<\/p>\n<pre style=\"padding-left: 30px\">aws rds modify-db-parameter-group --db-parameter-group-name <em>parameter_group_name<\/em> --parameters \"ParameterName=init_connect, ParameterValue=CALL mysql.rds_store_time_zone, ApplyMethod=immediate\"<\/pre>\n<p>3. \u00a0 Grant execute permission<\/p>\n<pre style=\"padding-left: 30px\">GRANT EXECUTE ON PROCEDURE mysql.rds_store_time_zone TO 'user'@'%';<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Amazon RDS doesn&#8217;t allow you to change timezone, It keeps same UTC time zone across\u00a0all regions.\u00a0time_zone variable in\u00a0the\u00a0parameter group is read only. You can change the time zone on each connection or session by making a procedure in default mysql database and call this function on each init connection. 1. \u00a0 \u00a0Create a procedure for [&hellip;]<\/p>\n","protected":false},"author":678,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":10},"categories":[1174,7],"tags":[76,1442],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14027"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/678"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=14027"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14027\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=14027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=14027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=14027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}