Skip to content

Instantly share code, notes, and snippets.

View muzhig's full-sized avatar
👨‍💻
working

Arseniy Potapov muzhig

👨‍💻
working
View GitHub Profile
@muzhig
muzhig / gist:18ac2374e4b3aa99dd59
Last active August 29, 2015 14:05
MySQL delete all tables
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;