Is it possible to force mysqldump to skip inserts for a specific table?

I regularly run mysqldump for the Drupal and human database, these cache tables can become huge. Given that the first thing I do after reloading the data is to clear the cache, I would love it if I could just skip all these lines. I do not want to skip table creation (with -ignore-tables), I just want to skip all these lines of cached data.

Is it possible to tell mysqldump to dump a CREATE TABLE INSERT to skip INSERT for a specific set of tables?

+7
source share
2 answers

You need to call mysqldump twice.

The mysql-stripped-dump script does just that.

+3
source

There is a --no-data option that does this, but affects all AFAIK tables. So you have to run mysqldump twice.

 # Dump all but your_special_tbl mysqldump --ignore-table=db_name.your_special_tbl db_name > dump.sql # Dump your_special_tbl without INSERT statements. mysqldump --no-data db_name your_special_tbl >> dump.sql 
+7
source

All Articles