Now that you have a basic understanding of how to do backups and restoration of MySQL databases, it's time to automate the backup process. One of the simplest methods is to use a PHP script to backup a MySQL database, then use your hosting cron feature to periodically run the PHP script depending on your backup needs (daily, weekly, or monthly).
A sample PHP script to get started is here: http://www.php-developer.org/php-script-to-backup-mysql-database-using-hosting-cron/. The key feature is that it will allow you to backup up to 4 MySQL database in your server using cron. Then the database backups are saved in your server specified by the $full_serverpath_to_backup variable.
For details, you can download the script, extract and test. Read the details inside cronmysqlbackup.php, those commented lines provide a good introduction for beginners. The actual steps are illustrated in Step 11 inside cronmysqlbackup.php and it is:
1.) Define your website MySQL login credentials such as username, password, hostname, database name, and so forth.
2.) Define the path to your cronmysqlbackup folder as defined by $full_serverpath_to_backup. You can optionally add other databases aside from your main website database.
3.) Decide how many days will you delete the old MySQL files. The unit is in days.
4.) Finally upload the cronmysqlbackup folder with cronmysqlbackup.php and .htaccess to the path above your web root.
5.) Enable hosting cron to automatically run this script at intervals you choose e.g. weekly, monthly
The path that you have uploaded should be the same path as what you have declared in $full_serverpath_to_backup
The concept of implementation for that script relies on mysqldump command, as you can see in these lines: