Compressing mysqldump ouput is a good practice since your sql dump file could be very big. The good thing is the result of the dump is in plain text, so tools such gzip can siginificanly reduce the size.
# mysqldump -u username -ppassword databasename | gzip > dbname.sql.`date +%Y-%m-%d_%H%M%S`.gzPut it to cron for daily backup. Cron treat '%' as special character so it needs to be escaped.
0 0 * * * mysqldump -u username -ppassword databasename | gzip > dbname.sql.`date +\%Y-\%m-\%d_\%H\%M\%S`.gz
0 comments:
Post a Comment