Bash Script for Daily backup of MySQL Database
In what way to plan MySQL database backup. A bash script for MySQL database backup. In this blog, you will discover a modest bash script, which receipts the backup of MySQL database and stock on the local system. This script will also to take away older backups from disk to free space. You can also custom this blog to backup MySQL database and stock a copy on the remote FTP server
Now, copy the subsequent content in a script file (like: /home/ubuntu/daily_backup.sh) and save on your Ubuntu system. Change the variable values in the script as per your requirements.
After producing or downloading script make certain to set execute permission to run correctly.
Schedule Script in Crontab
Now schedule the script in crontab to run daily and whole backup on consistent basis. Edit crontab on your system with crontab -e command. Add subsequent settings to enable backup at 9pm in the night.
Save your crontab file. After allowing cron, the script will take backup routinely, But keep check backups on a weekly or monthly basis to make sure.