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.
Windows
- Go to the official MySQL downloads page and get the MySQL Installer.
- Run it and choose "Developer Default" or "Server only".
- Follow the wizard; set a root password when asked.
- Finish, and MySQL runs as a Windows service.
The installer can also add MySQL Workbench, a visual tool covered in its own lesson.
macOS
- Download the macOS DMG from the MySQL site, or use Homebrew:
brew install mysql. - If using the DMG, run it and set the root password during setup.
- 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
- Download XAMPP (Windows, Mac or Linux) and install it.
- Open the XAMPP Control Panel.
- Click Start next to MySQL (it uses MariaDB, fully MySQL-compatible).
- 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 --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 --versionand log in withmysql -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?
What is the easiest way to install MySQL for learning?
What is the MySQL root password?
How do I check if MySQL is installed correctly?
mysql --version to see the version, then log in with mysql -u root -p. If you reach the mysql> prompt, the installation works.