Usage Instructions:
1. Launch an Instance
- From AWS Marketplace, select *Continue to Subscribe* → *Continue to Configuration*.
- Choose the recommended instance type (`t2.medium` or larger).
- Configure your VPC, subnet, and security group.
2. Set Security Group Rules
Allow:
- SSH (22) from your IP to access the instance.
- MySQL (3306) only from trusted sources if remote access is required.
3. Connect to the Instance
After launch, connect via SSH:
- ssh -i <your-key.pem> ubuntu@<Public-IP-of-Instance>
4. Initial Setup
On first login, the automated script will:
Prompt you to set a MySQL root password (or generate one automatically).
Ask if you want to enable remote MySQL connections.
Prompt you to configure firewall settings.
5. MySQL Access
Once setup is complete, access MySQL with:
mysql -u root -p
The root password is securely stored in:
/root/mysql_root_password.txt
6. Backups
A daily cron job backs up all databases to:
/home/ubuntu/mysql_backup/
Backup files older than 7 days are deleted automatically.
7. Restore from Backup
- To restore a database from a backup file, run:
/home/ubuntu/restore_mysql.sh <backup-file.sql>
8. Verification
Run `mysql -u root -p -e "SHOW DATABASES;"` to confirm setup.
Check `/var/log/mysql/` for logs if troubleshooting is needed.