How to change the system_time_zone in mysql?

Viewed 193

I verified that my global timezone is set to "+05:30" but the system_time_zone is showing UTC. I want to set system_time_zone to IST or "+05:30". I searched over the internet but couldn't find the solution.

mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| +05:30             |
+--------------------+
1 row in set (0.00 sec)


mysql> SELECT @@system_time_zone;
+--------------------+
| @@system_time_zone |
+--------------------+
| UTC                |
+--------------------+
1 row in set (0.00 sec)

I just want to set system_time_zone to IST. Can someone please help me?

1 Answers

The system timezone is not related to the database but to the OS. Check the documentation of your OS or share with us which OS you use.

Anyway, I would recommend always using UTC for the OS, the database and in your app. Then you can format the date/time in the right timezone at display time, based on the user's preference.

Related