#mysqldump -u dillon --password=xxxx database | gzip -c > /mnt/backup/db_`date +%Y%m%d%H%M`.sql.gz
It dumps database to a compressed file with date and time in the file name.
If you want to make it as a script or put it in corn job. Don't forget % need to be escaped.
#!/bin/bash
mysqldump -u dillon --password=xxxx database | gzip -c > /mnt/backup/db_`date +\%Y\%m\%d\%H\%M`.sql.gz
mysqldump -u dillon --password=xxxx database | gzip -c > /mnt/backup/db_`date +\%Y\%m\%d\%H\%M`.sql.gz
No comments:
Post a Comment