We have timezone set to IST (Indian Standard Time) to begin with -
mysql> show global variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | IST |
| time_zone | SYSTEM |
+------------------+--------+
SELECT @@global.time_zone, @@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| SYSTEM | SYSTEM |
+--------------------+---------------------+
1 row in set (0.00 sec)
mysql> select NOW();
+---------------------+
| NOW() |
+---------------------+
| 2017-10-31 17:05:26 |
+---------------------+
Above shows same time as server time, which is also in IST.
We want to change it to UTC. Comparing with a server where the timezone is UTC, the only different value on this server seems to be the system_time_zone
variable which is set to IST as shown above.
Not sure which variable/config to change.
We tried changing the default-time-zone
in my.ini but it changed the time_zone
variable and not the system_time_zone
.
Following will also attempt to update the time_zone
as I understand -
SET GLOBAL time_zone="+00:00";
So, not sure what will update the system_time_zone
.
Already checked https://stackoverflow.com/a/5359622/351903 Not sure what exactly is the difference between system_time_zone and time_zone.
Also, The Mysql documentation says -
The permissible values for --timezone or TZ are system dependent.
Unable to find the appropriate value for IST on windows and Cent OS servers. From this article it seems it needs some investigation. Can someone help here? Any pointers.
Background
What I want is to see a time difference of 5:30 hours when I do select NOW();
on the server. Currently it is displaying the same time as application server time (which is also IST). We are trying to add this discrepancy to reproduce a test scenario.
Update
Getting the following on my windows setup -
mysql> SET time_zone = 'Asia/Kolkata';
ERROR 1298 (HY000): Unknown or incorrect time zone: 'Asia/Kolkata'
mysql> SET time_zone = "Asia/Kolkata";
ERROR 1298 (HY000): Unknown or incorrect time zone: 'Asia/Kolkata'
mysql> SET time_zone = "UTC";
ERROR 1298 (HY000): Unknown or incorrect time zone: 'UTC'