HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

MySQL Installation

Before you can start working with MySQL, you need to install it on your computer. MySQL is available for all major operating systems — Windows, macOS, and Linux — and the installation process is beginner-friendly. This guide walks you through each platform step by step.


Which Version Should You Install?

MySQL comes in two main editions:

  • MySQL Community Server — Free, open-source, and the version used by most developers. This is what we will install.
  • MySQL Enterprise Edition — A commercial edition with extra features for large businesses. Requires a paid license.
Note: For learning, development, and most real-world web projects, the MySQL Community Server is all you need. It is completely free and full-featured.

Supported Operating Systems

MySQL works on all three major platforms. Choose the one that matches your computer:

🪟
Windows
🍎
macOS
🐧
Linux

Option 1: Install MySQL on Windows

The easiest way to install MySQL on Windows is through the official MySQL Installer. It is a guided setup wizard that installs MySQL Server and optionally MySQL Workbench (a visual management tool) in one go.

Step-by-Step Guide

1
Visit the official MySQL download page
Go to dev.mysql.com/downloads/installer/ — choose the MySQL Installer for Windows. Download the full offline installer (the larger file, around 400–500 MB).
2
Run the installer
Double-click the downloaded .msi file. If prompted by Windows security, click Yes to allow it to run.
3
Choose a setup type
Select "Developer Default" or "Server Only" depending on what you need. For beginners, "Developer Default" is recommended as it includes MySQL Server, Workbench, and other helpful tools.
4
Configure MySQL Server
During configuration, set a strong root password. The root user is the main administrator of your MySQL installation. Remember this password — you will need it to log in.
5
Complete the installation
Click through the remaining steps and finish the installer. MySQL Server will start automatically as a Windows service.
Tip: After installation, search for "MySQL Command Line Client" in the Windows Start menu to open the MySQL command-line interface and start running SQL queries immediately.

Option 2: Install MySQL on macOS

There are two ways to install MySQL on macOS — using the official .dmg package or using Homebrew (a macOS package manager). Both methods work well.

Method A: Using the Official DMG Package

1
Go to dev.mysql.com/downloads/mysql/ and select the macOS DMG Archive that matches your macOS version and chip (Intel or Apple Silicon).
2
Open the downloaded .dmg file and follow the installation wizard. Set your root password when prompted.
3
After installation, navigate to System Preferences → MySQL to start or stop the MySQL server.

Method B: Using Homebrew

If you already have Homebrew installed, this is the fastest way:

brew install mysql

After installation, start the MySQL service with:

brew services start mysql

Then run the security setup to set your root password:

mysql_secure_installation

Option 3: Install MySQL on Linux (Ubuntu / Debian)

MySQL is available directly from the default Linux package repositories. Open your terminal and run the following commands one by one:

Update Package Lists

sudo apt update

Install MySQL Server

sudo apt install mysql-server

Start MySQL Service

sudo systemctl start mysql

Run Security Setup

sudo mysql_secure_installation

This interactive script will guide you through setting a root password, removing anonymous users, and disabling remote root login — all good security practices for a fresh installation.

Note: On some Linux distributions (like CentOS or Fedora), the package manager is dnf or yum instead of apt. The MySQL package name may also vary — check the official MySQL documentation for your specific Linux distro.

Using XAMPP or Laragon (Beginner-Friendly Alternative)

If you are learning PHP and MySQL together, installing a local development environment like XAMPP or Laragon is an even easier approach. These tools bundle Apache, PHP, and MySQL into a single installation — no manual configuration needed.

Tool OS Support Includes MySQL Best For
XAMPP Windows, macOS, Linux ✔ Yes Beginners learning PHP + MySQL
Laragon Windows ✔ Yes Fast, modern local dev environment
MAMP macOS, Windows ✔ Yes macOS developers
MySQL Installer Windows ✔ Yes Standalone MySQL setup
Tip: If you are just starting out and plan to learn PHP with MySQL, installing Laragon (Windows) or XAMPP (all platforms) is the fastest way to get a fully working environment up and running — often in under 5 minutes.

Verify Your Installation

Once MySQL is installed, open a terminal or command prompt and log in to confirm it is working:

mysql -u root -p

You will be asked to enter your root password. After logging in successfully, you should see the MySQL prompt:

Welcome to the MySQL monitor.  Commands end with ; or \g.
mysql>

If you see the mysql> prompt, your installation is working correctly! You can now run SQL commands. Type exit; to close the MySQL client.


Key Points to Remember

  • Always install the MySQL Community Server — it is free and has everything you need
  • Set a strong root password during installation and keep it safe
  • On Windows, use the MySQL Installer for the easiest setup experience
  • On Linux, install via apt or yum and run mysql_secure_installation afterward
  • Beginners learning PHP + MySQL should consider XAMPP or Laragon for an all-in-one setup
  • Verify your install by running mysql -u root -p in the terminal
What's next? With MySQL installed, the next step is to explore MySQL Workbench — a powerful visual tool that lets you manage databases, run queries, and browse your data with a graphical interface — no terminal required!