1-- If you are dumping tables t1, t2, and t3 from mydb
2
3mysqldump -u... -p... mydb t1 t2 t3 > mydb_tables.sql
4
5/* If you have a ton of tables in mydb and you want to dump everything
6--except t1, t2, and t3, do this: */
7
8DBTODUMP=mydb
9SQL="SET group_concat_max_len = 10240;"
10SQL="${SQL} SELECT GROUP_CONCAT(table_name separator ' ')"
11SQL="${SQL} FROM information_schema.tables WHERE table_schema='${DBTODUMP}'"
12SQL="${SQL} AND table_name NOT IN ('t1','t2','t3')"
13TBLIST=`mysql -u... -p... -AN -e"${SQL}"`
14mysqldump -u... -p... ${DBTODUMP} ${TBLIST} > mydb_tables.sql
1#Take backup of database
2mysqldump database > backup-file.sql;
3
4#Restore database
5mysql database < backup-file.sql;