Problem with mysqldump of new data inserted after backing up data

Source: Internet
Author: User
Tags datetime time zones

The company has developed a database middleware system, which found that writing to datetime or timestamp fields occurs 8 hours longer than real time.

After the investigation, found that it is mysqldump to get a ghost

Because we are using the Maya maintenance long connection, and the long connection is reused, when the mysqldump is executed, mysqldump the--TZ-UTC parameter is enabled by default, and the time zone for this connection is set to the UTC time zone (while the timezone in Beijing is +08:00), Then a business using this database connection, will appear datetime/timestamp time + 8 hours.

Official Document Explanation:

--tz-utc

This option enables TIMESTAMP columns to is dumped and reloaded between servers in different. mysqldump sets its connection time zone to UTC and adds SET time_zone= ' +00:00 ' to the dump file. Without this option, TIMESTAMP columns are dumped and reloaded in the ' time zones ' to the ' source and destination serve RS, which can cause the values to change if the servers are in different time zones. --TZ-UTC also protects against changes due to daylight time. --TZ-UTC is enabled by default. To disable it, use--SKIP-TZ-UTC. This option is added in MySQL 5.1.2.

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.