Created
January 7, 2019 18:37
-
-
Save rpavez/16fc7099b341eac72aa6414173cac094 to your computer and use it in GitHub Desktop.
Remove
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
#!/bin/sh | |
export DB_NAME=<db_name> | |
export MYSQL_PASSWORD=<pass> | |
mysql -Nse 'show tables' $DB_NAME -u root -p$MYSQL_PASSWORD | while read table; do mysql -e "SET FOREIGN_KEY_CHECKS=0; truncate table $table;SET FOREIGN_KEY_CHECKS=1;" $DB_NAME -u root -p$MYSQL_PASSWORD ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment