Beckham _ mysql database backup and recovery _ MySQL

Source: Internet
Author: User
Mysql database backup and recovery: 1. database backup 2. database recovery 1. database backup 1. brief description of backup: incremental backup and overall backup are in operation of the system. example: backup is performed every Sunday and from Monday to Saturday. Mysql database backup and recovery Brief:
I. database backup
2. database recovery I. database backup

1. simple backup description: incremental backup and overall backup during system operation

For example, a full backup is performed every Sunday, and the backup is performed from Monday to Saturday.

If a problem occurs on Friday, you can recover it on Sunday + Monday, two, three, and four.

2. backup tools

A. third-party paid backup tools

B. The system's built-in backup function is mysqldump (you can export the database and table)

C. use outfile and infile

2.1 Examples of mysqldump

Example 1: export a table in a database

Mysqldump-u username-p password database name table 1 TABLE 2 table 3> path/backup file name

Back up the t table in the mugua database

(Note: the result of mysqldump is a series of SQL statements)

Example 2: How to export all tables in a database

Mysqldump-u username-p password database name> path/backup file name

Back up all tables in the mugua database

Example 3: How to export data in a database

Mysqldump-u username-p password-Database B database 1 Database 2 database 3> path/backup file name

Example 4: How to export all databases

Mysqldump-u username-p password-A> path/backup file name

Summary:

1. mysqldump exports SQL statements.

2. other usage of mysqldump

A. mysqldump: export the structure of the t table in the mugua database

B. mysqldump: export the data in table t of the mugua database

2.2 Use outfile and infile

(Note: outfile exports data from all columns of table t)

2. database recovery

1. operate on the command line

Mysql-u username-p password [Database name] <path/backup file name

1.1 Restore the t table in the mugua database

,

1.2 restore the mugua1 database

2. log on to mysql and use the source operation.

2.1 Restore the t table in the mugua database

(Source is equivalent \.)

2.2 restore the mugua1 database

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.