Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
MySQL + SQL · Lesson 138

MySQL Installation Guide

In this lesson: Install MySQL Server and Workbench step by step on Windows, Mac and Linux, set root password and test. Install now.

Before you install

To practise MySQL you need it installed on your computer. There are two paths: the official MySQL installer (full control) or XAMPP (easiest for beginners). During setup you will set a root password — remember it, as it is the master key to your databases.

💡 For learning, XAMPP is the quickest start. For a real MySQL server, use the official installer.

Windows

  1. Go to the official MySQL downloads page and get the MySQL Installer.
  2. Run it and choose "Developer Default" or "Server only".
  3. Follow the wizard; set a root password when asked.
  4. Finish, and MySQL runs as a Windows service.

The installer can also add MySQL Workbench, a visual tool covered in its own lesson.

macOS

  1. Download the macOS DMG from the MySQL site, or use Homebrew: brew install mysql.
  2. If using the DMG, run it and set the root password during setup.
  3. Start the server (System Settings pane, or brew services start mysql).

Homebrew is popular with developers because it is quick and easy to update.

Linux

# Ubuntu / Debian
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation

Install with the package manager, then run mysql_secure_installation to set the root password and remove insecure defaults. On Fedora/RHEL use dnf install mysql-server.

The easy way: XAMPP

  1. Download XAMPP (Windows, Mac or Linux) and install it.
  2. Open the XAMPP Control Panel.
  3. Click Start next to MySQL (it uses MariaDB, fully MySQL-compatible).
  4. Use phpMyAdmin (in the panel) or the command line to work with databases.

XAMPP is the fastest way to get a working MySQL for practice, with no complex configuration.

Verify and log in

mysql --version
mysql -u root -p
mysql Ver 8.0.x for ... Enter password: ****** mysql>

mysql --version confirms MySQL is installed. Then mysql -u root -p logs you in. Reaching the mysql> prompt means everything works.

Common mistakes

  • Forgetting the root password. Write it down — resetting it is a hassle.
  • Not starting the MySQL service. The server must be running to connect.
  • Port conflicts. If port 3306 is busy, another MySQL instance may be running.
  • Mixing installs. Do not run XAMPP's MySQL and a standalone MySQL at once.

Summary

  • Install MySQL via the official installer or, most easily, XAMPP.
  • Set and remember the root password during setup.
  • On Linux, use the package manager plus mysql_secure_installation.
  • Verify with mysql --version and log in with mysql -u root -p.
  • MySQL then runs locally, offline, ready for practice.

Next, run your first commands in MySQL first commands, or use the visual tool in MySQL Workbench.

Frequently Asked Questions

How do I install MySQL?
Download the MySQL Community Server (or MySQL Installer on Windows) from the official mysql.com site, run it, set a root password, and finish the wizard. On Mac use the DMG or Homebrew, on Linux use your package manager.
What is the easiest way to install MySQL for learning?
For beginners, XAMPP is the easiest: it bundles MySQL (MariaDB), Apache and PHP in one installer with a simple control panel. You just start MySQL from the panel, with no complex configuration.
What is the MySQL root password?
The root password is the master password for the main admin user (root). You set it during installation. Keep it safe, because root can create, change and delete any database.
How do I check if MySQL is installed correctly?
Open a terminal and run mysql --version to see the version, then log in with mysql -u root -p. If you reach the mysql> prompt, the installation works.
Do I need internet to use MySQL after installing?
No. Once installed, MySQL runs locally on your computer (localhost), so you can create databases and run queries offline. Internet is only needed to download the installer.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicMySQL Workbench Basics Your progress: 138 / 151 (91%) · Lesson 139 / 151 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free