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