Skip to content

Instantly share code, notes, and snippets.

@tusharvikky
Last active June 28, 2016 07:45
Show Gist options
  • Save tusharvikky/cd90d552011c6801721a7ddbb8e9b4e2 to your computer and use it in GitHub Desktop.
Save tusharvikky/cd90d552011c6801721a7ddbb8e9b4e2 to your computer and use it in GitHub Desktop.
Drop all tables of a DB
mysql -u<db_username> -p<db_password> -Nse 'show tables' <db_name> | while read table; do echo "SET FOREIGN_KEY_CHECKS = 0; drop table $table;"; done | mysql -u<db_username> -p<db_password> <db_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment