MySQL

Mysql and System time diffrence

MySQL time zone different from system time zone

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 |
+------------------+--------+

Addon – check mysql time

mysql> select NOW();
+---------------------+
| NOW() |
+---------------------+
| 2014-06-20 19:07:05 |
+---------------------+
1 row in set (0.00 sec)