Page 1/2 of MySQL automatic backup and restoration methods after database destruction

Source: Internet
Author: User
After the database server is set up, the first thing we need to do is not to consider which MySQL-initiated programs should be run on the server that supports the database, but when the database is damaged, how to safely restore to the last normal state to maximize data losses

After the database server is set up, the first thing we need to do is not to consider which MySQL-initiated programs should be run on the server that supports the database, but when the database is damaged, how to safely restore to the last normal state to maximize data losses

I. Preface:

After the database server is set up, the first thing we need to do is not to consider which MySQL-initiated programs should be run on the server that supports the database, but when the database is damaged, how to safely restore to the last normal state, minimizing data loss.

In other words, just the establishment of a database server can only describe what it can do, and it does not mean what it can do stably. Disaster recovery efficiency and comprehensiveness are also a quasi-factor in system stability, especially for a server system.

This section describes the automatic database backup and restoration methods after the database is damaged. Here, we use mysqlhotcopy and define a Shell script to implement automatic database backup. In addition, the entire process of automatic data backup and data recovery is based on Shell.

Prerequisites for creating a database backup

[1] creating an automatic backup script

Here, in order to make the database backup and recovery meet our actual requirements, use a Shell script to automate the entire backup process.

[2] Run the automatic database backup script

[3] Let the database backup script run automatically every day

Test whether automatic backup works properly (Backup Recovery Method)

Here, we will introduce the recovery method after the problem occurs through the actual operation process.

[1] restoration method after database Deletion

First, create a database for testing.

Then, run the database backup script you just created to back up the database you just created for testing.

Next, we log on to the MySQL server again and delete the database test we just created to test whether the data recovery is successful.

Above, we simulate the database destruction process. Next, we will use the backup method to restore the database after it is damaged.

Then, log on to the MySQL server again to check whether the database has been successfully restored.

The preceding result indicates that after the database is deleted, the data is successfully restored to the status before the database is deleted.

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.