MySQL dump tables matching a pattern

Quick command to dump all tables matching a like pattern. In the example drop tables option is added with xargs.

mysql $DB -u$USERNAME -p$PASSWORD -e 'show tables like "$LIKE%"' | grep -v Tables_in | xargs mysqldump --add-drop-table $DB -u$USERNAME -p$PASSWORD


Posted

in

by