There're two ways to backup selected tables in MySQL:
- Include Table
- Ignore Table
You can backup tables by positively and explicitly listing all necessary ones. The syntax is as following:
mysqldump -h <host> -u <username> -p <db_name> <table_name> ...
You may skip the host option -h if you operate in the localhost. For example:
[root@localhost ~] mysqldump -u root -p db1 table1 table2 table3 > positive.sql
You can backup tables by negatively and explicitly listing all non-necessary ones. The syntax is as following:
mysqldump -h <host> -u <username> -p <db_name> --ignore-table=<db_name>.<table_name> ...
You may skip the host option -h if you operate in the localhost. For example:
[root@localhost ~] mysqldump -u root -p db1 --ignore-table=db1.table98 --ignore-table=db1.table99 > negative.sql