Sometimes I need to quick backup my database and download it to my pc, I use mysqldump command to do that and to save time of downloading, i compress it with gzip, here the command :
$ mysqldump -u MySQLuser -pMySQLpassword --opt db-name l gzip -c -9 > /path/to/backup/folder/backup-name.sql.gz
remember not to put spaces between -p and the password
and after i've download it, I create a db-name database in MySQL, and restore the backup using command :
$ gzip -d /path/to/backup/folder/backup-name.sql.gz
$ mysql -u MySQLuser -pMySQLpassword db-name < /path/to/backup/folder/backup-name.sql
remember not to put spaces between -p and the password !!
Subscribe to:
Post Comments (Atom)
1 comment:
nice, thanks
Post a Comment