Regex#
To use mydumper’s regex feature simply use the
--regex option. In the following example mydumper
will ignore the test and mysql databases
# mydumper --regex '^(?!(mysql\.|test\.))'
Once can use –regex functionality, for example not to dump mysql, sys and test databases:
# mydumper --regex '^(?!(mysql\.|sys\.|test\.))'
To dump only mysql and test databases:
# mydumper --regex '^(mysql\.|test\.)'
To not dump all databases starting with test:
# mydumper --regex '^(?!(test))'
To dump specific tables in different databases (Note: The name of tables should end with $:
# mydumper --regex '^(db1\.table1$|db2\.table2$)'
If you want to dump a couple of databases but discard some tables, you can do:
# mydumper --regex '^(?=(?:(db1\.|db2\.)))(?!(?:(db1\.table1$|db2\.table2$)))'
Which will dump all the tables in db1 and db2 but it will exclude db1.table1 and db2.table2
Of course, regex functionality can be used to describe pretty much any list of tables.