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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With