Installing MySQL on Windows
Introduction
To practice SQL locally, install the MySQL Server on Windows using the official MySQL Installer. This chapter downloads the MSI, configures root password and port 3306, registers a Windows service, and verifies login—matching what production-style Java and Node apps expect.
Prerequisites
- What Is MySQL
- Windows 10 or 11 with administrator rights
- ~500 MB disk space
Download MySQL Installer
- Open MySQL Community Downloads — Installer
- Download the full offline MSI (larger file, ~300–500 MB)—more reliable on slow networks than the web installer
| Installer | When to use |
|---|---|
| Full MSI | Recommended for tutorials |
| Web MSI | Small download; fetches components online |
Run the MSI; accept UAC if prompted.
Setup Type
| Type | Installs | Choice |
|---|---|---|
| Server only | MySQL Server | Recommended for this track |
| Full | Server + Workbench + extras | OK if you want GUI immediately |
| Custom | Pick components | Advanced |
Select Server only → Next → Execute to install.
Server Configuration
High availability
Choose Standalone MySQL Server / Classic MySQL Replication.
Type and networking
| Setting | Value |
|---|---|
| Config Type | Development Computer |
| Port | 3306 (default) |
| TCP/IP | Enabled |
Authentication
Keep Use Strong Password Encryption (caching_sha2_password) for MySQL 8 with modern clients.
Set a strong root password—you will use it often.
Warning
Remember the Root Password
Resetting forgotten root on Windows is tedious—store in a password manager.
Windows service
| Setting | Value |
|---|---|
| Run as Windows Service | Yes |
| Service name | MySQL80 (default) |
| Start at boot | Yes for convenience |
Finish configuration; installer may open MySQL Workbench—optional.
Add mysql to PATH (Optional)
Default client path:
C:\Program Files\MySQL\MySQL Server 8.0\binAdd to System Environment Variables → Path so PowerShell finds mysql:
mysql --versionRestart terminal after PATH change.
Verify Installation
Check service:
Get-Service MySQL80Status should be Running.
Login:
mysql -u root -pEnter root password. Prompt changes to:
mysql>Run:
SELECT VERSION();
SHOW DATABASES;Exit:
EXIT;Code explanation:
-u root— user root-p— prompt for password (no space before password on same flag in scripts)
Common Windows Issues
| Problem | Fix |
|---|---|
mysql not recognized | Add bin to PATH or use full path |
| Port 3306 in use | Change port in installer or stop conflicting app |
| Service will not start | Check Event Viewer; reinstall if corrupt |
| Access denied | Wrong password; retry or reset root |
See also JDBC Windows install for driver-focused notes.
FAQ
MySQL vs XAMPP MySQL?
XAMPP bundles MariaDB/MySQL for PHP stacks—pick one server to avoid port conflicts.
Workbench not installed?
Re-run installer → Add MySQL Workbench via Custom/Full, or use DBeaver.
WSL2 Linux MySQL instead?
Valid alternative—see Installing MySQL on Linux inside WSL.
Uninstall cleanly?
Windows Apps & features → MySQL Server → Uninstall; remove data folder if reinstalling fresh.
Firewall?
Local localhost needs no rule; remote access requires opening 3306—avoid for dev.
Which MySQL 8 minor version?
Latest 8.0.x from installer is fine.