How to skip certain database tables with mysqldump?
Replace username, database_name, and table1 with your specifics. The --ignore-table flag tells mysqldump to *exclude certain tables from your backup.
The multiple-skips play: Excluding numerous tables
Enjoy a customized backup experience by skipping more than one table:
Now, table1 and table2 join the "not-my-type of tables" club and are not included in the dump.
The ultimate script: Automated exclusion
To remember all tables you want to exclude is like remembering all syntax errors you ever had. Use a Bash script that reads table names from a file:
The picky backup: Data-and-structure selective dump
Let's make mysqldump a picky dumper, excluding table data or structure:
Extra sugar: Advanced tips for smooth dump experience
One-shot picture: Consistent dumps
Just like you wouldn't want to blink during a group photo, use --single-transaction for consistent snapshots:
Frugal backup: Compression on the fly
Combine mysqldump with gzip to be mighty and frugal:
Special-case tables: Skip triggers
Sometimes, we want triggers out of this dumping party and --skip-triggers fits the bill:
Privacy first: Password handling
For securing your password, put a -p flag without space:
Effective restoration
Once backed up, we've to set things back to normal:
Multi-database dump
For multi-database environments, --ignore-table pairs up with --databases:
Was this article helpful?