Recover a library and a table from a MySQL full-library backup
One, full library backup-a
[[Email protected] backup] #mysqldump-uroot-p123456--default-character-set=utf8--single-transaction-- Extended-insert=false--hex-blob--master-data=2--log-error=/tmp/test.err--routines--triggers--events--quick-- Flush-logs--all-databases > Fulldump.sql
Second, only restore the report library from the full backup
[Email protected] backup]# mysql-uroot-p123456 report--one-database <fulldump.sql
It can be seen that the main parameter used here is the--one-database shorthand-o parameter, which greatly facilitates our recovery flexibility.
Third, only restore the T_order table from the full backup
1) Restore table structure from backup query
[[email protected] backup]# sed-e '/./{h;$!d;} '-E ' x;/create TABLE ' t_order '/!d;q ' Fulldump.sql
DROP TABLE IF EXISTS ' T_order ';
/*!40101 SET @saved_cs_client = @ @character_set_client */;
/*!40101 SET character_set_client = UTF8 */;
CREATE TABLE ' T_order ' (
' c_date ' varchar (+) DEFAULT NULL,
' order_no ' varchar (+) DEFAULT NULL,
' Key_info ' varchar ($) DEFAULT NULL,
' Flag ' varchar (+) DEFAULT NULL
) Engine=innodb DEFAULT Charset=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
2) Querying the table data from the backup
[[email protected] backup]# grep ' INSERT into ' t_order ' Fulldump.sql >data.sql
Or
Restore a library first, back up a table separately, restore a table to the http://blog.itpub.net/30345407/viewspace-2123125/
Recover a library and a table "go" from a MySQL full-library backup