Drop all tables from MySQL database

From time to time I stumbled over the case, that I had to drop all tables from a MySQL database. In phpMyAdmin or other GUI-based tools – in general – you only have the possibility to drop the whole database. But then you have to recreate it from the scratch.  Or you have to click-drop each table separately.  Another common – but not that clever – practise is it to delete each table by a separate drop command or by list them manually in a drop statement (see https://dev.mysql.com/doc/refman/5.7/en/drop-table.html). All at all not that comfortable!

That’s why I wrote this MySQL database procedure to drop all tables from MySQL databases.

The inspiration for this procedure I got from http://stackoverflow.com/questions/12403662/how-to-drop-all-mysql-tables-from-the-command-line (first answer by Devart). Thanks a lot!

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.