Environment Introduction:
OS Version: RHEL5.5
MySQL version: 5.5.40
Reference Link: http://dev.mysql.com/doc/refman/5.5/en/time-zone-leap-seconds.html
There is a need: An attendance system, multiple APS distributed around the world, time must be in the 8 time zone to calculate, it must modify the MySQL server time to decide!
View MySQL server current time zone
Mysql> Show variables like '%time_zone% ';
+------------------+--------+
| variable_name | Value |
+------------------+--------+
| System_time_zone | CST |
| Time_zone | SYSTEM |
+------------------+--------+
2 rows in Set (0.00 sec)
Modification Method:
Method 1: Modify the MY.CNF
[Mysqld]
Default-time-zone= ' "
Save, exit
Restarting the MySQL server
Method 2: Modify the Parameters
mysql> Set time_zone = ' "";
Verify:
Mysql> Show variables like '%time_zone% ';
+------------------+--------+
| variable_name | Value |
+------------------+--------+
| System_time_zone | CST |
| Time_zone | +08:00 |
+------------------+--------+
2 rows in Set (0.00 sec)
Mysql> Select Now ();
+---------------------+
| Now () |
+---------------------+
| 2011-18-21 18:39:07 |
+---------------------+
1 row in Set (0.00 sec)
MySQL Time zone parameters