MySQL Time Zone parameter, mysql Time Zone

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.