Skip to content

Instantly share code, notes, and snippets.

@yevrah
Created September 2, 2014 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevrah/6974d57e8f310b820616 to your computer and use it in GitHub Desktop.
Save yevrah/6974d57e8f310b820616 to your computer and use it in GitHub Desktop.
MySQL Backup Script
#!/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