Last active
April 17, 2019 18:04
-
-
Save EduardoSP6/341524869084b06de5f228983993c2ed to your computer and use it in GitHub Desktop.
How to drop all tables from Mysql Database
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
# select database | |
USE database_name; | |
# disable relationships | |
SET foreign_key_checks=off; | |
# this command will retreive the drop command for all tables from database. So just copy the result and execute | |
SELECT concat('DROP TABLE IF EXISTS ', TABLE_NAME, ';') FROM information_schema.TABLES WHERE table_schema = 'database_name'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment