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;

2 thoughts on “Script to drop all tables form a database.

  1. You actually make it seem so easy with your
    presentation but I find this topic to be really something which I think
    I would never understand. It seems too complicated and extremely broad for
    me. I’m looking forward for your next post, I will try to get the hang of it!

  2. I recently included this weblog to our reader, exceptional items. Can not get adequate!

Leave a Reply

Your email address will not be published. Required fields are marked *