After writing a simple shell script for MySQL database backup. This is our new advance bash script for MySQL database dump. This script will provide you to backup MySQL database and upload backups to various remote locations like FTP, SFTP and Amazon s3 bucket.
This script is available on our Github account with all supporting file. You can simply download the script and run it on your server. Use the following steps to use this script and configure backups within 5 min.
Step 1 – Clone this Repository
Download this repository put files under /etc/mydumpadmin directory. Alternatively, you may also clone this repository under /etc directory using the following commands.
cd /etc/ git clone https://github.com/tecrahul/mydumpadmin.git
Step 2 – Configure Setup
settings.conffile and update all required values as per your requirements. You can enable/disable FTP, SFTP and s3 backups as well
credentials.txtfile and put your mysql server login details.
Step 3 – Execute Backup Script
Set the execute permission on shell script and run this as following commands.
chmod a+x mysql-dump.sh ./mysql-dump.sh
Step 4 – Schedule Daily Cron
You can also schedule this to run on daily basis using crontab. Add the following settings to crontab to run on 2:00 AM daily.
0 2 * * * cd /etc/mydumpadmin && ./mysql-dump.sh