/ tech-note

How to drop all tables in MySQL?

It is simple enough if you don't care about permissions, etc..., which is true of my local test database.

mysql -uUSER -p -e "drop database YOUR_DB;"
mysql -uUSER -p -e "create database YOUR_DB;"
mysql -uUSER -p YOUR_DB < SQL_FILE.sql

And now you get a refreshed DB.


If you don't mind getting deeper, here is an alternative way to drop tables.