Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This sql script helps to drop entire scema from a database
SET FOREIGN_KEY_CHECKS = 0;
SET SESSION group_concat_max_len = 1000000;
SET @TABLES = NULL;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name,'`') INTO @TABLES FROM information_schema.tables
WHERE table_schema = 'databaseName';
SET @TABLES = CONCAT('DROP TABLE IF EXISTS ', @TABLES);
PREPARE stmt FROM @TABLES;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET SESSION group_concat_max_len = 1024;
SET FOREIGN_KEY_CHECKS = 1
@jyotendra

This comment has been minimized.

Copy link
Owner Author

@jyotendra jyotendra commented May 25, 2021

Credits to original post.

Replace the "databaseName" with name of your DB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment