MySQL Auto Backup

First create a shell script which is used to backup database, here we named the script as

In above command, we use date command to generate current date, and use it as part of filename.

After that we need to make this file executable


To make this backup script run automatically, we should create a cronjob. Type following command to open cronjob editor

crontab -e

Write following text and save it

Above command means the cronjob will run at 0:00 everyday