Backup and recovery of small-shell _mysql database

Source: Internet
Author: User

MySQL database backup and recovery Brief:
One, database backup
Second, database recovery One, database backup

1, Backup simple description: System operation, incremental backup and overall backup

Example: Every Sunday overall backup, Monday to Saturday backup day

If there is a problem in Friday, you can use the whole of Sunday + Monday, two, three, asphyxication recovery

2. Backup Tools

A, third-party billing Backup tool

b, the system comes with backup function namely mysqldump (Can export library, table)

C, using outfile and infile

2.1. Mysqldump Use Example

Example 1, exporting a table under a library

Mysqldump–u User name –p password Library Name table 1 table 2 Table 3> Path/backup file name

Back up the T table under the Mugua library

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

Example 2, how to export all the tables under a library

Mysqldump–u User name –p password Vault name > Path/backup file name

Back up all tables under the Mugua library

Example 3, how to export in library units

Mysqldump–u User name –p password –b Library 1 Library 2 Library 3 > Path/backup file name

Example 4, how to export all libraries

Mysqldump–u username –p Password –a > Path/backup file name

Summarize:

1, mysqldump exports are SQL statements.

2, mysqldump other uses

A, mysqldump export the structure of the T-table under the Mugua library


B, mysqldump export the data of table T in Mugua Library

2.2. Using outfile and InFile

(Note: This means that outfile exports all of the columns of Table T data)

Second, database recovery

1. Operation at command line

Mysql–u User name –p password [database name]< path/backup file name

1.1, restore the T-table under the Mugua library


1.2. Recover MUGUA1 Library



2. Log in to MySQL and use the source operation

2.1, restore the T-table under the Mugua library


(source equals \.)

2.2. Recover MUGUA1 Library



The quieter become,the more you is able to hear!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Backup and recovery of small-shell _mysql database

Related Article

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.