简体   繁体   中英

Append dump to existing MySQL dump file

i need to Dump all data for 2 tables and a subset of data from another 2 tables in a MySQL database. So suppose i have tables t1,t2,t3,t4, I need full dump of t1 and t2 and get it using

mysqldump -u... -p... mydb t1 t2  > mydb_tables.sql

Now, i need to append this .sql file with dump for tables t3 ,t4 , but both are just subset of actual tables(like SELECT * from t3 where id<1000 ). Is it possible to append existing dump file mydb_tables.sql

Else, is there any method using which i can dump all 4 table data into a single file?

You can use append method, like we append the regular files

eg:
    cat file2 >> file1

You can dump using ">>" instead of ">"

">" overwrites the destination file where as ">>" appends to destination file.

mysqldump -u... -p... mydb t1 t2  > mydb_tables.sql

mysqldump -u... -p... mydb t3 t4  >> mydb_tables.sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM