Skip to content

MufaroDKaseke/mysql-s3-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL To AWS S3 bucket

A simple batch script to automate MySQL backups on XAMPP (Windows), upload them to AWS S3

Prerequisites

Before using this script, ensure:

  • XAMPP is ofcourse installed (C:\xampp or modify the path in the script).
  • AWS CLI is installed and configured with credentials (aws configure).
  • You have an S3 bucket and Access Key ready for uploads.

Setup

  1. Clone the repository:

    git clone hhttps://github.com/MufaroDKaseke/mysql-s3-backup.git
    cd mysql-s3-backup
  2. Install AWS CLI (if not already installed):
    Download AWS CLI

    aws --version
    > aws-cli/2.24.15 Python/3.12.9 Windows/11 exe/AMD64
  3. Configure AWS CLI with your credentials:

    aws configure

    This will prompt you for:

    • AWS Access Key ID
    • AWS Secret Access Key
    • Default region name (e.g., af-south-1)
    • Default output format (e.g., json)
  4. Edit the script and set your S3 bucket name:

    set s3_bucket=s3://<your-bucket-name>/mysql-backups/
  5. Run the script:

    mysql_backup.bat

    The script will:

    • Check if MySQL is running on port 3306
    • Create a backup directory if it doesn't exist
    • Create a timestamped backup of all MySQL databases
    • Upload the backup to your specified S3 bucket
  6. Check if it worked:

    aws s3 ls s3://<your-bucket-name>/mysql-backups/

    Or just check the bucket in AWS Console: S3 Bucket You should see your backup files listed with today's timestamp.

Let me know if you need further modifications! 🚀

About

A simple batch script to automate MySQL backups on XAMPP (Windows), upload them to AWS S3, and clean up old backups.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors