Skip to content

Instantly share code, notes, and snippets.

@EduardoSP6
Last active April 17, 2019 18:04
Show Gist options
  • Save EduardoSP6/341524869084b06de5f228983993c2ed to your computer and use it in GitHub Desktop.
Save EduardoSP6/341524869084b06de5f228983993c2ed to your computer and use it in GitHub Desktop.
How to drop all tables from Mysql Database
# 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