Create MySQL Backup Script

Now, copy the following content in a script file (like: /backup/ and save on your Linux system. After than change some configuration values in section “Update below values” in the script as per your environment.


After creating script make sure to set execute permission to run properly.

chmod +x /backup/

Schedule Script in Crontab

Now schedule the script in crontab to run on a daily basis and complete backup on regular basis. Edit crontab on your system with crontab -e command. Add following settings to enable backup at 3 in the morning.

0 3 * * * root /backup/

Save your crontab file. After enabling cron, the script will take backup automatically, But keep check backups on a weekly or monthly basis to make sure.