Last Updated: February 25, 2016
·
283
· msankhala

Drop all tables in a database

This works even for tables with constraints (foreign key relationships). Alternatively you can just drop the database and recreate, but you may not have the permission to do that.

mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep -e '^DROP \| FOREIGN_KEY_CHECKS' | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]