Installation
When starting with MySQL, you have two main options for installation:
- Local Setup → Install MySQL on your personal computer/server.
- Cloud-Based Solutions → Use MySQL as a managed service from cloud providers.
Both have their own use cases, so let’s explore them.
Local Setup
-
Download MySQL Installer
- Visit MySQL official downloads.
- Choose version: Community Edition (free, open source).
-
Install MySQL Server
- Run the installer.
- Select "MySQL Server" and optionally tools like:
- MySQL Workbench (GUI for database design/queries).
- MySQL Shell (advanced CLI).
-
Configure Server
- Choose:
- Port (default: 3306).
- Authentication (strong password for root user).
- Data directory (where your DB files will be stored).
- Choose:
-
Verify Installation
-
Open terminal/command prompt and type:
mysql -u root -p -
Enter your password → You’re inside the MySQL shell.
-
Cloud Solutions
Running MySQL on cloud platforms allows you to offload infrastructure management (hardware, networking, patching, backups) while focusing on database usage, scaling, and replication.
Using MySQL on Amazon RDS
-
Create RDS Instance
- Go to AWS Console → RDS → Create database.
- Select MySQL as the engine.
- Choose free tier (for practice).
- Set username (admin) and password.
-
Get Connection Endpoint
-
AWS gives you a host URL like:
mydb-instance.abcd1234.us-east-1.rds.amazonaws.com
-
-
Connect to Cloud MySQL
From local machine:
mysql -h mydb-instance.abcd1234.us-east-1.rds.amazonaws.com -u admin -pEnter password → You are now connected to the cloud DB.
-
Run SQL Queries
Local vs Cloud Setup
| Feature | Local Setup | Cloud Setup |
|---|---|---|
| Installation | Manual (installer, config) | Ready-to-use (just create instance) |
| Cost | Free (Community Edition) | Pay-as-you-go (some free tiers) |
| Scalability | Limited by your machine | Auto-scaling, global reach |
| Maintenance | You manage backups, upgrades | Managed by cloud provider |
| Best for | Learning, small projects | Production apps, enterprise systems |