sudo crontab -e
The following cronjobs will run every hour. Make sure you replace the database connection string values (make sure you have the right privileges on the database being used.) and backup folder paths with the appropriate ones.
0 * * * * cd /cron/backup && tar -zcvf backup.tar.gz /var/www/html/ 0 * * * * mysqldump -u user_name -p'password' db_name> /cron/backup/backup.sql
Now save the changes and restart the cron service.
Ctrl+O Enter Ctrl+X sudo service cron restart