Seemingly strong mysql backup policy sharing

Source: Internet
Author: User
Tags mysql backup

Dump is performed at every day to back up the corresponding database, and binlog files of the corresponding database are updated.
If a database error is found, you only need to recover the previous dump backup and then restore the binlog file of the current day.

Example:
Run the following command at every day:

Copy codeThe Code is as follows: mysqldump database -- flush-logs-uroot-p -- opt> database_20020601. SQL

Executed according to the date rule.

If you want to restore the database to this morning, then:

1. Complete backup of the entire database

Copy codeThe Code is as follows: cd/var/lib/mysql
Mysqldump-uroot-p123456 mydata> mydata. bak

2. Delete the database backed up

Copy codeThe Code is as follows: rm-rf mydata

3. Recover with dump

Copy codeThe Code is as follows: mysql-uroot-p123456
Mysql database-uroot-p123456 <database_20020601. SQL

4. Use binlog for time-based recovery

Copy codeCode: mysqlbinlog -- stop-date = "10:18:49"/var/lib/mysql/mysql-bin.000006 | mysql-uroot-p123456

Note:
1. It is best to save the dump backup and binlog backup in remote-remote backup.
2. mysql master-slave replication.

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.