Install MySQL on Windows
Install MySQL on Windows: Complete Setup Guide
Installing MySQL on Windows gives you a local database server for building and testing PHP, Python, Node.js, or Java applications offline. The official MySQL Installer configures both the background server service and the command-line client in one wizard.
Download and Run MySQL Installer
Visit dev.mysql.com and download the MySQL Installer for Windows (mysql-installer-community). Choose the larger offline installer if your network connection is unstable.
- Launch the installer and pick Custom setup type so you only install what you need.
- Select MySQL Server 8.0 (or 8.4 LTS) along with MySQL Workbench or MySQL Shell.
- Click Execute to download and install the selected packages.
Configure Server Port, Password, and Service
During the configuration wizard, keep the default networking and service options unless another local database already uses port 3306:
- Config Type: Choose Development Computer so MySQL uses modest RAM on your laptop.
- Port: Keep
3306and leave the firewall checkbox enabled for local connections. - Authentication Method: Select Use Strong Password Encryption (
caching_sha2_password), which all modern drivers support. - Root Account & Service: Set a strong
rootpassword and keep Configure MySQL Server as a Windows Service (MySQL80) checked so it starts automatically.
Add MySQL to Windows System PATH
Adding the bin folder to your System PATH lets you run mysql from any PowerShell or Command Prompt window:
- Open Edit the system environment variables from the Windows Start menu.
- Edit the Path variable under System Variables and add
C:\Program Files\MySQL\MySQL Server 8.0\bin. - Open a fresh terminal and verify your installation:
mysql --version
mysql -u root -p
Common Windows Setup Issues
- Port 3306 Already in Use: Stop conflicting XAMPP or MariaDB services in
services.msc, or assign MySQL to port3307during setup. mysqlNot Recognized: Restart your terminal after editingPATHso Windows reloads environment variables.
Frequently Asked Questions
Can I use Docker or Laragon instead of the MSI installer on Windows?
Yes, tools like Laragon, Herd, or Docker Desktop spin up isolated MySQL instances without altering global Windows services.
How do I start or stop MySQL on Windows manually?
Open an Administrator PowerShell window and run net start MySQL80 or net stop MySQL80.
Which port does MySQL listen on by default?
MySQL listens on TCP port 3306 by default for standard client connections.
Unlock Your
Full Potential.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Try it Yourself
Experiment with the code from this lesson in our interactive playground.