Created
May 20, 2020 13:01
-
-
Save thomasheller/8f8cf16fe7953b48da72240975fd8743 to your computer and use it in GitHub Desktop.
Drop all tables in MySQL database
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
echo 'SET FOREIGN_KEY_CHECKS = 0;' > tmp.sql | |
mysqldump --add-drop-table --no-data <user, password, db> | grep 'DROP TABLE' >> tmp.sql | |
echo 'SET FOREIGN_KEY_CHECKS = 1;' >> tmp.sql | |
mysql <user, password, db> < tmp.sql | |
rm tmp.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment