Sunday, June 26, 2016

Fix TImezone on RDS Mysql MariaDB

In this post i will explain the steps to fix the timezone UTC "issue" on RDS (if we can call it an issue...). If you need to do that you have to follow this guide. I used MariaDB as mysql fully compatible database.

1) Connect to your RDS instance via shell or client

2) Create the following stored procedure 
DELIMITER | CREATE PROCEDURE mysql.store_time_zone () IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN SET SESSION time_zone = 'Europe/Rome'; END IF | DELIMITER ; 

3) Grant permission to the user 
GRANT EXECUTE ON PROCEDURE `mysql`.`store_time_zone` TO 'usersql'@'%'; 

4) Create a new parameter group with eg. Timezonefix 

5) In the search bar search for "init_connect" 

6) Insert the following value: CALL mysql.store_time_zone 

7) Go to your rds instance and modify it selecting the new parameters group 

8) Apply immediatly 

9) Reboot your instance and the job is done.


Read more...