Created
September 9, 2013 17:30
-
-
Save tovbinm/6498848 to your computer and use it in GitHub Desktop.
Backup/Restore with MySQL
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
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