It is best practice to backup databases to a secondary location for preservation in case of equipment failure or catastrophe. You can back up the database in your hosting server cPanel by following the below steps.
Add Cron Job
- Log into your hosting server cPanel.
- Go to Advanced section and click on Cron Jobs.
- Select the interval.
- Add the cron job command
- Click Add New Cron Job.
Add command as
/usr/bin/mysqldump -h localhost -u "root" -p"XXXXXXX" "outputtime" | gzip -c > "/home/backup/OutputTime-`date +\%Y-\%a-\%H`-BK.sql.gz"
The resulting file will be saved in the database backup folder using today’s date/time.
CRON Job lists