Created
December 13, 2011 18:46
-
-
Save nelsonpecora/1473305 to your computer and use it in GitHub Desktop.
Quick MySQL & git database backup
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
| #!/bin/bash | |
| # This script should properly dump a mysql db, add, and commit it to git | |
| echo "Please enter database name: " | |
| read db_name | |
| echo "Username: " | |
| read user | |
| echo "Password: " | |
| read -s pass | |
| mysqldump -u $user -p$pass --skip-extended-insert $db_name > $db_name.sql | |
| git add $db_name.sql | |
| git commit -m "database backup, $(date)" | |
| echo "-------------------------------------" | |
| echo "Database backup added to git." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment