SQL statement to be executed in MySQL direct backup data file

Source: Internet
Author: User

This article describes how to directly back up data files in MySQL and how to execute SQL statements in actual operations, the following is a detailed description of the main content of the article. I hope you will gain some benefits after browsing it.

Compared with the previous methods, backing up data files is the most direct, fast, and convenient. The disadvantage is that Incremental backup is basically not supported. To ensure data consistency, run the following SQL statement before the back-to-back file:

 
 
  1. Flush tables with read lock;


That is, the data in the memory is refreshed to the disk, and the data table is locked to ensure that no new data is written during the copy process. In this way, the backup data recovery is also very simple, just copy it back to the original database directory.

Note: For an Innodb table, you also need to back up its log file, that is, the ib_logfile * file. Because when the Innodb table is corrupted, these log files can be recovered.

For systems with medium business volume, the backup policy can be set as follows: the first full backup, the daily Incremental backup, and the weekly full backup are repeated. For important and BUSY systems, full backup may be required once a day, Incremental backup once an hour, or even more frequently. To achieve online backup and Incremental Backup without affecting online services, the best way is to use the master-slave replication mechanism (replication) to back up data on the slave machine.

 

The above content is the description of the MySQL direct backup data file, hoping to help you in this regard.

Original article title: Direct backup of data files

Connection: http://www.cnblogs.com/kfarvid/archive/2009/11/12/1601587.html

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.