For creating a cron job
in general, you may view this post:
For creating a specific cron command that'll dump your database, compress it, and store it in a specific file, I can help with that. Be warned though, I've tried this command on various servers and it's only worked on some of them. Oddly enough, some cron commands only work with some servers. I am currently running a Linux server with cPanel, so if you've got the same, this might work for you. If not, contact your host and someone should be able to help. Cron commands are oftentimes easy for systems admins to put together.
To create your cron job, log into cPanel and access your Cron Job
page. Then, set up the times and days of the week you'd like the job to run. Finally, the create the command, you can use something like this:
mysqldump --user=database_user --password='database_password' database_name | gzip > /home/yourhostingaccount/database_name.sql.gz
Obviously, you'd want to change out the "database_user," "password," database_name," and "yourhostingaccount" variable to your own. I just placed them in there to make things easier.
As you can see the command used gzip to compress the database and then saves it out in the user account of the home directory as an .sql.gz file. I think that's what you wanted.
For more instructions and ideas for creating a database dump cron command, check out these resources:
That last link actually covers how to do backups and restores in cPanel. It does give cron command instructions though.