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