Last active
October 20, 2015 13:20
-
-
Save micc83/7615f81d035c938e72e5 to your computer and use it in GitHub Desktop.
Cronjob to drop tables and import dump file to 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
#!/bin/bash | |
mysqldump -u[username] -p[password] \ | |
--add-drop-table --no-data [database] | \ | |
grep -e '^DROP \| FOREIGN_KEY_CHECKS' | \ | |
mysql -u[username] -p[password] [database] | |
mysql -u[username] -p[password] [database] < [dump_file.sql] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment