Remove all tables from a MySQL schema

by GarciaPL on Thursday 6 March 2014

A few days ago I found very useful solution (thanks for Biomathematicus!) for deleting tables from a MySQL schema. I know that it could be quite difficult for some developers (also for me) to manually remove every table from schema without removing this schema itself. So, there is a two-step solution which is going to help you removing a lot of tables from SQL database.

1) List all tables in the MySQL schema :

SELECT CONCAT('drop table ',table_name,'; ')
FROM information_schema.tables
WHERE table_schema = 'yourDatabaseName';

2) Copy result and paste it to query window and execute.
drop table table1; 
drop table table2;

Reference : [1] Biomathematicus.blogspot.com Remove all tables from mysql schema