MySQL Time Zone parameter, mysql Time Zone
Environment Introduction:
OS Version: RHEL5.5
MySQL version: 5.5.40
Reference: http://dev.mysql.com/doc/refman/5.5/en/time-zone-leap-seconds.html
There is a requirement: an attendance system, where multiple APs are distributed across the world, and the time must be calculated in the + 8 time zone. It must be determined by modifying the MySQL server time!
View the current time zone of mysql server
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 my. cnf
[Mysqld]
Default-time-zone = '+ 8:00'
Save and exit
Restart the mysql server
Method 2: Modify parameters
Mysql> set time_zone = '+ 8:00 ';
Verification:
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 () |
+ --------------------- +
| 18:39:07 |
+ --------------------- +
1 row in set (0.00 sec)