public
Last active

MySQL delete all tables

  • Download Gist
mysql_delete_tables.sh
Shell
1 2 3 4
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.