O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exclude/include database objects using regex

Take a backup of all databases ending with prod:

shell> mysqlpump --include-databases=%prod --result-file=db_prod.sql

Suppose there are some test tables in some databases and you want to exclude them from the backup; you can specify using the --exclude-tables option, which will exclude tables with the name test across all databases:

shell> mysqlpump --exclude-tables=test --result-file=backup_excluding_test.sql

The value of each inclusion and exclusion option is a comma-separated list of names of the appropriate object type. Wildcard characters are permitted in object names:

  • % matches any sequence of zero or more characters

  • _ matches any single character

Apart from databases and tables, you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required