View the RDS current time zone

By default, AWS RDS uses UTC time. Our region is generally located in the East 8, so our local time is UTC+8.

Connect to RDS and query for the time zone of the current instance.

show variables where variable_name like 'time_zone';

The following results are displayed, representing the UTC of the current RDS time zone.

time_zone UTC

Adjust the RDS time zone

Time zone adjustment for RDS is operated by adjusting the parameter set. AWS RDS does not allow modification of the default parameter group. Therefore, it is necessary to make sure that the current RDS parameter group is not the default parameter group. If it is the default parameter group, you need to create a new parameter group. Then adjust the TimeZone related parameters on this parameter group, and then change the parameter group used by RDS to use the new parameter group.

Enter from the parameter group menu on the left to create a parameter group. We usually adjust this by copying the current set of parameters as a template. Select the group of parameters you are currently using, Actions->Copy. For example, the current parameter group in use is pG-mysql57-demo, and the new parameter group copied is pG-mysql57-demo-new.

Next, you can Modify the parameters of the new parameter group. Click the parameter group to enter the details page, search the keyword TIME_ZONE, and then click MODIFY to Modify the parameters. You can find the value we need from the optional values, here we select Asia/Shanghai, and finally confirm the change.

Enter the parameter group again, search time_zone, and find that the value has been modified to Asia/Shanghai, indicating that the modification has been completed.

Now that the parameter set has been incrementing, it is time to apply the parameter set to the corresponding instance. Go to the RDS that needs to be adjusted, and in Parameter Group Configuration, select the new Parameter Group. Once the changes are confirmed, the system will prompt you to apply them immediately. Depending on the situation, you can choose to modify it now or the next maintenance window. Changing time_zone requires restarting the database instance. Here we select the next downtime window to restart.

Select the right time to restart the RDS.

Verify modification in effect

After the RDS is restarted, execute the time zone query above again and display the following result (Asia/Shanghai), indicating that the time zone has been changed successfully.

show variables where variable_name like 'time_zone';

time_zone Asia/Shanghai


Happy Coding.