dinsdag 30 juli 2013

The best DROP-script for Mysql!

There are many situations in which you want to drop all tables in a MySQL database. You can easily drop the schema, but then all the permissions are lost too. There are several solutions out there, but they all require some manual effort. I wanted to get rid off it once and for all and constructed this easy script. With the following evil shell script you can easily drop all tables in your database.

Premisse: it uses a group on table_catalog which may not always be the correct grouping in your database. Please, feel free to adapt!

Just create a textfile like drop.sh and give it appropriate rights to execute. The paste the following content in the file and save it.


Use ./drop.sh root root my_db et voilá.... all tables are gone.

Off course, things can be improved. I need to check the parameters and add some documentation...

Geen opmerkingen:

Een reactie posten