DEV Community

Munish Kumar sharma
Munish Kumar sharma

Posted on

How to Install and Set Up MySQL on Windows 11, Linux, and macOS (2026 Complete Guide)

Setting up a database locally is a fundamental backend skill. Whether you're building with Node.js, PHP, Python, or Java — understanding how to install and configure MySQL properly gives you real control over your development environment.

In this 2026 updated guide, you’ll learn:

  • How to install MySQL on Windows 11

  • How to install MySQL on Linux (Ubuntu/Debian)

  • How to install MySQL on macOS

  • How to secure your installation

  • How to verify everything works

If you prefer video learning, I’ve also created a full step-by-step walkthrough here:

🎥 Watch the complete installation tutorial:

👉 https://youtu.be/vm5GjZ28MSU


What is MySQL?

MySQL is one of the world’s most popular open-source relational database management systems (RDBMS). It stores data in structured tables and is widely used in modern web development.

It works seamlessly with:

  • Node.js

  • PHP

  • Python

  • Java

  • .NET

  • MERN / MEAN Stack

If you're learning backend development in 2026, MySQL is still highly relevant.


Install MySQL on Windows 11 (2026)

https://www.w3schools.com/mysql/img_win_install1.png

https://www.tutorials24x7.com/sites/default/files/inline-images/step6_1.jpg

https://www.javaguicodexample.com/mysqldetailedconfiguration_files/mysqlwindetailinstall001.png

4

Step 1: Download MySQL Installer

  1. Visit the official MySQL website.

  2. Download MySQL Installer for Windows.

  3. Choose either:

*   Web Installer (small file)

*   Full Installer (offline version)
Enter fullscreen mode Exit fullscreen mode

For most developers, the Web Installer is sufficient.


Step 2: Run the Installer

  1. Open the downloaded file.

  2. Choose setup type:

*   **Developer Default (Recommended)**

*   Server Only

*   Custom
Enter fullscreen mode Exit fullscreen mode

If you're coding, choose Developer Default.


Step 3: Configure MySQL Server

During setup:

  • Configuration Type → Development Machine

  • Port → Keep default (3306)

  • Authentication → Use strong password authentication

  • Set root password (important)

Complete the configuration process.


Step 4: Verify Installation

Open Command Prompt and run:

mysql --version
Enter fullscreen mode Exit fullscreen mode

If it shows the version number, installation is successful.

You can also open MySQL Workbench to manage databases visually.


Install MySQL on Linux (Ubuntu/Debian)

https://www.cherryservers.com/v3/assets/blog/2023-11-06/04.png

https://i.sstatic.net/2hXQi.png

https://www.netikus.net/documents/MySQLServerInstallation/setrootpassword.jpg

4

Step 1: Update System

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Step 2: Install MySQL Server

sudo apt install mysql-server
Enter fullscreen mode Exit fullscreen mode

Step 3: Secure Installation

sudo mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

Follow the prompts:

  • Set root password

  • Remove anonymous users

  • Disallow remote root login

  • Remove test database

Choose Yes for most security options.


Step 4: Start and Enable MySQL

sudo systemctl start mysql
sudo systemctl enable mysql
Enter fullscreen mode Exit fullscreen mode

Check status:

sudo systemctl status mysql
Enter fullscreen mode Exit fullscreen mode

Login:

sudo mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

Install MySQL on macOS (2026)

https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/images/mac-installer-dmg-introduction.png

https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/images/mac-installer-summary.png

https://dev.mysql.com/doc/mysql-macos-excerpt/5.7/en/images/mac-installer-preference-pane-location.png

4

Method 1: Using DMG Installer (Recommended)

  1. Download the macOS .dmg installer from the official MySQL website.

  2. Open the file.

  3. Follow installation steps.

  4. Set root password.

  5. MySQL will appear in System Settings.


Method 2: Using Homebrew

If you use Homebrew:

brew update
brew install mysql
Enter fullscreen mode Exit fullscreen mode

Start MySQL:

brew services start mysql
Enter fullscreen mode Exit fullscreen mode

Verify:

mysql --version
Enter fullscreen mode Exit fullscreen mode

Secure Your MySQL Installation

Always run:

mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

This improves security by:

  • Removing anonymous users

  • Disabling remote root login

  • Removing test databases

  • Strengthening password setup

Security should never be skipped.


Test Your MySQL Setup

Login:

mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

Create a test database:

CREATE DATABASE testdb;
SHOW DATABASES;
Enter fullscreen mode Exit fullscreen mode

If it appears in the list, your installation works perfectly.


Common MySQL Installation Errors (2026)

MySQL Not Recognized as Command

Add MySQL bin folder to your system PATH.

Windows:

  • Search "Environment Variables"

  • Add MySQL bin directory to PATH

macOS/Linux:

export PATH="/usr/local/mysql/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

Port 3306 Already in Use

Edit MySQL configuration file (my.ini or my.cnf) and change the port number.


Why Installing MySQL Locally Still Matters in 2026

Yes, cloud databases like:

  • AWS RDS

  • PlanetScale

  • Supabase

are powerful.

But if you don’t understand:

  • Local configuration

  • Services

  • Authentication

  • Ports

  • Security

You’ll struggle when debugging real production systems.

Strong backend developers know their environment inside out.


Final Thoughts

Installing MySQL isn’t just a setup task. It’s foundational backend knowledge.

If you're serious about web development, master these basics before jumping into cloud abstractions.

Again, if you prefer video guidance, watch the complete walkthrough here:

🎥 https://youtu.be/vm5GjZ28MSU

Top comments (0)