What MySQL is and why you might install it
MySQL is a database program that stores and organizes information. If you are building a website, running a local process, or learning to code, you may need MySQL running on your own computer so you can test your work before putting it online. MySQL is free and works on Windows, Mac, and Linux.
When you install MySQL, you are putting the actual database engine on your machine. This is different from just using a database someone else runs — you control it, you can stop and start it, and you can create as many test databases as you need. Most people install it because they are following a tutorial, building a website locally, or learning SQL (the language used to talk to databases).
The installation process differs slightly depending on whether you use Windows, Mac, or Linux, but the steps are straightforward and take 10 to 20 minutes from read to first use.
Key Takeaways
- read MySQL from the official MySQL website, choosing the version that matches your operating system (Windows, Mac, or Linux).
- Run the installer and choose a setup type — "Developer Default" is the easiest choice for learning or local development.
- During installation, you will set a root password, which is the main administrative password for your MySQL server.
- After installation completes, MySQL runs as a background service and starts automatically when you restart your computer.
- You can test that MySQL works by opening a command prompt or terminal and connecting with the mysql command.
Downloading MySQL for your operating system
Go to dev.mysql.com/downloads/mysql in your web browser. The page shows read options for Windows, Mac, and Linux. Choose the one that matches your computer.
For Windows, read the "MySQL Installer" file (the .msi file). For Mac, read the DMG file. For Linux, you can read a tar file or use your system's package manager (apt-get on Ubuntu, yum on CentOS). The file size is typically 200 to 400 megabytes, so the read takes a few minutes on a normal internet connection.
Save the file to your Downloads folder or anywhere you can find it easily. You do not need to unzip or extract anything yet — the installer handles that.
Running the installer on Windows
Double-click the .msi file you downloaded. A window appears asking whether you want to allow the installer to make changes to your computer — click "Yes". The MySQL Installer opens and shows you a list of products to install.
For a first installation, select "Developer Default" at the top of the list. This installs MySQL Server, MySQL Workbench (a tool for managing databases), and a few other useful programs. Click "Next" and the installer shows you what will be installed. Click "Next" again to proceed.
The installer downloads and installs the files. This takes a few minutes. When it finishes, a "Product Configuration" window appears. Click "Next" to configure MySQL Server. Choose "Standalone MySQL Server / Classic MySQL Replication" and click "Next".
On the next screen, leave "Config Type" set to "Development Machine" and "MySQL Port" set to 3306 (the standard port). Click "Next". You will then be asked to set the MySQL Root Password — this is the main administrative password for your database server. Type a password you will remember, confirm it, and click "Next". The configuration completes, and MySQL is now installed and running.
Running the installer on Mac
Double-click the DMG file. A window opens showing the MySQL installer package. Double-click the .pkg file inside. A setup wizard appears asking for permission to install software — enter your Mac password and click "Install Software".
The installer asks you to choose a setup type. Select "Development Default" to install MySQL Server and MySQL Workbench. Click "Continue" and agree to the license. The installer downloads and installs the files.
When installation finishes, a configuration window appears. Choose "Use Strong Password Encryption" and click "Next". You will be asked to set the MySQL Root Password. Type a password you will remember, confirm it, and click "Next". MySQL is now installed and running as a background service on your Mac.
Installing on Linux
On Ubuntu or Debian-based systems, open a terminal and run this command: sudo apt-get install mysql-server. The system asks for your password — type it and press Enter. The package manager downloads and installs MySQL automatically.
During installation, you will be prompted to set the MySQL root password. Type a password you will remember and confirm it. When the installation finishes, MySQL is running and will start automatically when you restart your computer.
On other Linux distributions like CentOS or Fedora, use sudo yum install mysql-server instead. The process is the same — the package manager handles the read and installation, and you set the root password during setup.
Testing that MySQL is working
Open a command prompt (Windows) or terminal (Mac or Linux). Type this command: mysql -u root -p and press Enter. The system asks for your password — type the root password you set during installation and press Enter.
If MySQL is working, you will see a prompt that looks like mysql>. This means you are connected to the MySQL server. Type SHOW DATABASES; (including the semicolon) and press Enter. You should see a list of default databases like "information_schema" and "mysql".
Type EXIT; to close the connection and return to your normal command prompt. If you see the mysql prompt and the list of databases, MySQL is installed and working correctly.
What to do after installation
MySQL is now running in the background on your computer. It starts automatically when you restart, so you do not need to do anything to keep it running. When you are building a website or following a tutorial that needs a database, your process can connect to MySQL on your local machine.
If you installed MySQL Workbench (the graphical tool), you can open it and connect to your local MySQL server to create databases and tables visually instead of typing commands. For most learning purposes, this is easier than using the command line.
If you need to stop MySQL temporarily, you can do so through your system settings. On Windows, open Services and find "MySQL80" (or the version number you installed), right-click it, and select "Stop". On Mac, go to System Preferences, find MySQL, and click "Stop MySQL Server". On Linux, use sudo systemctl stop mysql.
Frequently Asked Questions
What is the root password and why do I need it?
The root password is the main administrative password for your MySQL server. It lets you create new databases, add users, and change settings. You set it during installation. Write it down somewhere safe — if you forget it, resetting it is complicated. For a local development machine, you can use any password you will remember.
Can I install MySQL on a computer that already has other programs?
Yes. MySQL does not interfere with other software. It runs as a background service and uses port 3306 by default. As long as nothing else is using that port, installation will succeed. If you get an error about the port being in use, you can change the port during installation setup.
Do I need to install MySQL Workbench too?
No. MySQL Workbench is optional — it is a graphical tool that makes it easier to manage databases if you do not want to type commands. You can use MySQL from the command line alone. If you chose "Developer Default" during installation, Workbench was installed automatically, but you do not have to use it.
How do I know if MySQL is running?
On Windows, open Services (search for "Services" in the Start menu) and look for "MySQL80" or your version number — if it says "Running", MySQL is active. On Mac, go to System Preferences and look for MySQL. On Linux, run sudo systemctl status mysql in a terminal. You can also try connecting with the mysql command — if it works, the server is running.
What if the installer fails or gives an error?
The most common cause is that MySQL is already installed. Uninstall it first (through Control Panel on Windows, Applications on Mac, or your package manager on Linux) and try again. Another cause is insufficient disk space — MySQL needs at least 500 megabytes free. If you get a port error, something else is using port 3306; you can change the port during setup or close the conflicting program.