It is best practice to back up 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’s cPanel.
- Go to Advanced section and click on Cron Jobs.
- Select the interval.
- Add Cron job command
- Click Add New Cron Job.
Add command as
/usr/bin/mysqldump -h localhost -u "root" -p"XXXXXXX" "outputbooks" | gzip -c > "/home/backup/OutputBooks-`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