Beckham _ mysql database backup and recovery, _ mysql Database Backup
Mysql database backup and recoveryBrief:
I. Database Backup
2. database recoveryI. 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
The quieter you become, the more you are able to hear!
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.