Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created April 28, 2013 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emjayess/5478400 to your computer and use it in GitHub Desktop.
Save emjayess/5478400 to your computer and use it in GitHub Desktop.
drop mysql tables with the given table prefix 'mytableprefix_'
mysql --database=mydb --host=my.host --user=myuser -e "show tables" -s |
egrep "^mytableprefix_" |
xargs -I "@@" echo mysql --database=mydb --host=my.host --user=myuser -e "DROP TABLE @@";
@emjayess
Copy link
Author

the above will echo the 'DROP TABLE' statements... drop the echo command to execute them immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment