Skip to content

Instantly share code, notes, and snippets.

@rgo
Created September 21, 2010 14:49
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 rgo/589780 to your computer and use it in GitHub Desktop.
Save rgo/589780 to your computer and use it in GitHub Desktop.
MySQL delete all tables
#!/bin/bash
MYSQL="mysql -h HOST -u USERNAME -pPASSWORD -D DB_NAME"
$MYSQL -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQL
unset MYSQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment