major.io words of wisdom from a systems engineer

MySQL time zone different from system time zone

In some situations, the system time zone will be different than the one in MySQL, even though MySQL is set to use the system time zone. This normally means that a user has changed the system time zone, but they haven’t started MySQL to cause it to change as well.

$ date
Sun Jul  1 11:32:56 CDT 2007
mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | PDT    |
| time_zone        | SYSTEM |
+------------------+--------+
2 rows in set (0.00 sec)

If you find yourself in this situation, just restart MySQL and the situation should be fixed:

mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | CDT    |
| time_zone        | SYSTEM |
+------------------+--------+
2 rows in set (0.00 sec)