Last active
August 29, 2015 14:25
-
-
Save proxium/c322c043efb0a4a5568e to your computer and use it in GitHub Desktop.
Shell command to do the drop (of all tables) in one shot
This file contains 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
# Drop all tables from YOUR_DBSCHEMA_NAME | |
mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD -BNe "show tables" YOUR_DBSCHEMA_NAME | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD YOUR_DBSCHEMA_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment