Last active
March 20, 2019 14:33
-
-
Save EdoardoVignati/4694505ffc1fd10692010ac992170c82 to your computer and use it in GitHub Desktop.
DELETE all tables in a database using MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just copy the following lines changing [databasename] and execute it. | |
SELECT CONCAT('DROP TABLE ', GROUP_CONCAT(table_name SEPARATOR ',')) | |
AS delete_stmt INTO @query | |
FROM information_schema.tables WHERE table_schema = '[databasename]'; | |
PREPARE stmt_drop FROM @query; | |
EXECUTE stmt_drop; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment