logo

Art Of Eclipse

« Home » « About » « Github »


Script to drop all tables form a database.

Just for my reference here is a script that will drop all the tables from the database at once
and don’t forget to replace the username, password and database name 😛

for i in $(mysql -u username -ppassword databasename -e "Show tables;" | grep -v Tables_in | grep -v "+"); do mysql -u username -ppassword databasename -e "drop table $i; "; done;