Skip to content

Instantly share code, notes, and snippets.

@Disassembler0
Last active October 14, 2019 18:24
Show Gist options
  • Save Disassembler0/db44fb84f744b84e4ed384eb6ed9d633 to your computer and use it in GitHub Desktop.
Save Disassembler0/db44fb84f744b84e4ed384eb6ed9d633 to your computer and use it in GitHub Desktop.
mysql -NB information_schema -e "SELECT table_name FROM tables WHERE table_schema = 'yourdb' AND table_name like 'yourprefix_%'" | xargs -n 1 -I"{}" mysql dbname -e "DROP TABLE {}"
mysql -NB information_schema -e "SELECT table_name FROM tables WHERE table_schema = 'yourdb' AND table_name like 'yourprefix_%'" | xargs -I"{}" mysqldump yourdb {} >dump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment