Last active
August 29, 2015 14:18
-
-
Save PerpetualBeta/d8b2d4e788eb24a57baa to your computer and use it in GitHub Desktop.
A MySQL script that will generate a list of statements to drop all DBs on a server.
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
-- Run this script | |
SELECT CONCAT('DROP DATABASE `', schema_name, '`;') AS stmt | |
FROM information_schema.schemata | |
WHERE schema_name NOT IN ('information_schema', 'performance_schema', 'mysql') | |
ORDER BY SCHEMA_NAME; | |
-- Copy the output into your clipboard | |
SET FOREIGN_KEY_CHECKS = 0; | |
-- Paste from the clipboard and run the "drop" set | |
SET FOREIGN_KEY_CHECKS = 1; | |
-- USE WITH CAUTION | |
-- CREDIT: http://stackoverflow.com/a/18279731/632985 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment