# mysqldump: how to ignore tables

By default, mysqldump includes all the tables in the dump. However, in special cases you may need to exclude some tables. This can be easily achieved using the flag --ignore-table.

# Excluding a single table

In order to tell mysqldump you want to exclude a single table, all you have to do is add the flag --ignore-table followed by the name of the table you want to exclude.

mysqldump my_database --ignore-table=my_table > my_backup.sql

After executing the command from the example above, the output file my_backup.sql will contain all the tables from the database my_database except the table my_table.

# Excluding multiple tables

In case you want to exclude more than one table, add the flag once for each table you don't want to be part of the dump.

mysqldump my_database --ignore-table=my_first_table --ignore-table=my_second_table > my_backup.sql

Runnning the above command will instruct mysqldump to exclude the tables my_first_table and my_secnd_table from the dump.