Full mysql backup with cron job in cpanel

This is how to do daily mysql backup with cron job in cpanel. This cron job will backup your mysql database as dump file (and gzip) daily. The files will be replaced on the same day next week.

Command to run to dump your mysql database, gzip it and replace it the following week as follow

1
mysqldump -uDBUSERNAME -pPASSWORD --opt DBNAME > /home/USER/dbbackup/FILENAME.sql; gzip -f /home/USER/dbbackup/FILENAME.sql

Replace DBUSERNAME, PASSWORD, DBNAME, USER, FILENAME respectively.

Leave a Reply

Your email address will not be published. Required fields are marked *