Skip to content

Instantly share code, notes, and snippets.

@tovbinm
Created September 9, 2013 17:30
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 tovbinm/6498848 to your computer and use it in GitHub Desktop.
Save tovbinm/6498848 to your computer and use it in GitHub Desktop.
Backup/Restore with MySQL
DB=my_db
mysqldump -uroot -h localhost $DB --opt --compress | gzip -9 -c > $DB-backup-`date +%Y%m%d%H`.sql.tgz
gunzip -c $DB-backup-`date +%Y%m%d%H`.sql.tgz > a.sql
mysql -u root $DB < a.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment