MySQLdump Incremental backup, full backup, and recovery (1)

Source: Internet
Author: User

It is important to back up your database when database tables are lost or damaged. In the event of a system crash, you must be able to restore as much data as possible from your table to the State at the time of the crash. Scenario: perform a full backup every Sunday, and execute the MySQLdump Incremental backup at one o'clock P.M. every day.

MySQLdump Incremental Backup configuration

The precondition for performing Incremental backup is that MySQL enables the log-bin switch, for example, adding

Log-bin =/opt/Data/MySQL-bin

The string after "log-bin =" is the log recording directory. It is generally recommended that it be placed on a disk different from the MySQL data directory.

MySQLdump Incremental Backup

Assume that a full backup is performed at one o'clock P.M. on Sunday, which is applicable to the MyISAM storage engine.

MySQLdump-lock-all-tables-flush-logs-master-data = 2-u root-p test> backup_sunday_1_PM. SQL

Replace-lock-all-tables with-single-transaction for InnoDB
Flush-logs generates a new log file to end the current log.
The master-data = 2 Option records the name of the new log file after full backup in the output SQL statement,

For future recovery reference, for example, the output backup SQL file contains:

Change master to MASTER_LOG_FILE = 'mysql-bin.000002 ', MASTER_LOG_POS = 106;

Other descriptions of MySQLdump Incremental Backup:

If-delete-master-logs is added to MySQLdump, the previous logs are cleared to free up space. However, if the server is configured as an image copy master server, it is dangerous to use MySQLdump-delete-master-logs to delete the MySQL binary log, because the slave server may not completely process the binary log. In this case, it is safer to use the purge master logs.

Create a log by using MySQLadmin flush-logs on a daily basis and end the previous log writing process. And back up the previous log, such as the log file MySQL-bin.000002 under the data directory in the previous example ,...


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.