This is a simple script to backup a MySQL database to an Amazon S3 bucket or Digital Ocean Space.
It uses mysqldump
alongside with s3cmd
.
- Setup s3cmd before running the script
To use DigitalOcean Spaces check this : https://www.digitalocean.com/docs/spaces/resources/s3cmd/
- Copy the script to your server
wget https://gist.github.com/obrassard/708ee07cc15161c91069680dbbd3aa36/raw/backup-s3-db.sh
- Make it executable
cmod +x backup-s3-db.sh
- Run it
./backup-s3-db.sh <database-name> <s3-bucket-name>