Created
September 2, 2014 06:22
-
-
Save yevrah/6974d57e8f310b820616 to your computer and use it in GitHub Desktop.
MySQL Backup Script
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 | |
set -x # Debug Script | |
HOST=localhost | |
PASS=pass | |
# Additional options for review --opt --complete-insert --flush-logs --force --quote-names --add-drop-database --lock-tables --insert-ignore --comments | |
# See: http://www.iheavy.com/2012/08/09/5-things-you-overlooked-with-mysql-dumps/ | |
#Structure Only | |
mysqldump --verbose --no-data --all-databases --complete-insert --skip-quote-names --hex-blob --host=$HOST -u root -p\"$PASS\" > db_schema_only_$HOST_`/bin/date +\%m\%d\%Y`.mysql | |
#Structure and Data | |
mysqldump --all-databases --compress --complete-insert --skip-quote-names --hex-blob --host=$HOST -u root -p\"$PASS\" > db_full_$HOST_`/bin/date +\%m\%d\%Y`.mysql | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment