Dump only tables with a certain prefix from a MySQL database
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Dump only the database tables with a given prefix from a MySQL database.

This is useful if you have a database with a large number of different WordPress, Omeka, or other type applications installed. Each of those installs would have a different table prefix (like wp_, or omeka_). This will do a mysqldump for just those tables, rather than needing to dump the whole database.

The port (DBPORT) and host (DBHOST) for the database are hard coded in the script, so change these as needed. The default uses settings for MAMP on Mac OSX.

Some common examples:

  • MAMP on Mac OSX

  • Many default LAMP servers


How To Use

  • Copy the script to any directory.

  • Set the execute bit

    chmod u+x tabledump
  • Edit the DBPORT and DBHOST variables if needed

  • Run like so:


The script will prompt for the database name, the prefix, the database username and the password (twice).