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
mysql -Nse 'show tables' DATABASE -uMYUSER -pMYPASSWORD | while read table; do mysql -e "truncate table $table" DATABASE -uMYUSER -pMYPASSWORD ; done | |
# With FOREIGN_KEY_CHECKS | |
mysql -Nse 'show tables' DB_NAME -uMYSQL_USER -pMYSQL_PASSWORD | while read table; do mysql -e "SET FOREIGN_KEY_CHECKS=0; truncate table $table;SET FOREIGN_KEY_CHECKS=1;" DB_NAME -uMYSQL_USER -pMYSQL_PASSWORD ; done |