How to install MySQL on Windows

To install MySQL on Windows you need two things from dev.mysql.com: the MSI package with the server and MySQL Configurator, which comes inside it. This guide is for MySQL 8.4 LTS on Windows 11 and Windows 10, 64-bit. It also covers the mysql command in the terminal, MySQL Workbench and the errors people hit most.

Which MySQL to download

Open dev.mysql.com/downloads/mysql. The version list has long-term support releases, marked LTS, and short-lived Innovation releases. Take an LTS one: 8.4 LTS works with most tutorials and frameworks, 9.7 LTS is the newer line. The steps below are the same for both, only the folder names change.

  • Choose Microsoft Windows as the operating system and download Windows (x86, 64-bit), MSI Installer. MySQL runs only on 64-bit Windows.
  • On the next page you can skip signing in: the link No thanks, just start my download starts the download.
  • MySQL 8.4 needs the Microsoft Visual C++ Redistributable (x64). A fresh Windows doesn’t have it, and the MSI then stops with This application requires Visual Studio 2019 x64 Redistributable. Install it first from Microsoft’s site or with winget: winget install --id Microsoft.VCRedist.2015+.x64 -e

The old MySQL Installer, with many products in one package, ends with MySQL 8.0. From 8.1 on, MySQL’s own docs say to use the MSI of each product.

How to install MySQL on Windows with the MSI

  1. Double-click the downloaded mysql-8.4.…-winx64.msi, accept the licence and choose the Typical setup. The server goes to C:\Program Files\MySQL\MySQL Server 8.4.
  2. Allow the installer to make changes when Windows asks.
  3. On the last page leave the option to run MySQL Configurator ticked and click Finish. The server doesn’t start until it is configured.

You can also install the package with winget in Terminal opened as administrator. It installs MySQL 8.4 without questions. Then open MySQL Configurator from the Start menu and go through the next section.

winget install --id Oracle.MySQL -e

Set up the server in MySQL Configurator

  1. Data Directory: keep C:\ProgramData\MySQL\MySQL Server 8.4\. Databases and the my.ini settings file live there.
  2. Type and Networking: for a PC you develop on, choose Development Computer as the config type. Keep TCP/IP with port 3306. If no other computer needs to reach this server, untick Open Windows Firewall ports for network access.
MySQL Configurator on the Type and Networking page: Development Computer, TCP/IP on port 3306 and the firewall option
  1. Accounts and Roles: type a password for root in MySQL Root Password and again in Repeat Password. Use your own strong password and keep it: Configurator asks for it again later. Here you can also add a user for your app with Add User.
  2. Windows Service: leave Configure MySQL Server as a Windows Service and Start the MySQL Server at System Startup on. The service is named MySQL84 by default. Keep Standard System Account.
  3. Server File Permissions: keep the first option, which gives access to the data folder only to the service and administrators.
  4. Sample Databases are optional. On Apply Configuration click Execute, wait for all steps to turn green, then click Next and Finish.

MySQL 8.4 signs users in with caching_sha2_password. The old mysql_native_password method is off by default in 8.4 and removed in 9.x. Up-to-date drivers and Workbench work with the new method.

Use the mysql command in Terminal

The MSI doesn’t add MySQL to PATH, so a new Terminal doesn’t know the mysql command yet. Add the folder once:

  1. Open Start, type “environment” and choose Edit the system environment variables. Click Environment Variables.
  2. Under System variables select Path, click Edit, then New, and paste C:\Program Files\MySQL\MySQL Server 8.4\bin. Click OK in every window.
  3. Close Terminal and open it again: windows that were already open keep the old PATH.

Now check the client and sign in as root with the password from Configurator. The second command asks for it and prints the server version.

mysql --version mysql -u root -p -e "SELECT VERSION();"

To give your app its own database and user instead of root, run this and change the names and the password to your own:

mysql -u root -p -e "CREATE DATABASE app; CREATE USER 'app'@'localhost' IDENTIFIED BY 'choose-a-strong-password'; GRANT ALL PRIVILEGES ON app.* TO 'app'@'localhost';"

Install MySQL Workbench

Workbench is MySQL’s own app for tables, queries and users. It is a separate MSI at dev.mysql.com/downloads/workbench, or a winget package:

winget install --id Oracle.MySQLWorkbench -e

In Workbench click + next to MySQL Connections, set the host to 127.0.0.1, port 3306, user root, and click Test Connection. It asks for the root password.

If MySQL doesn’t install or start

  • 'mysql' is not recognized as an internal or external command, operable program or batch file (in PowerShell: The term 'mysql' is not recognized): the bin folder is not in PATH. Add it as above and open a new Terminal.
  • ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061): the service is not running. Start it in the Services app, or in Terminal as administrator. See its state: Get-Service MySQL* Then start it: Start-Service MySQL84
  • ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES): the password is wrong. Check the keyboard layout and Caps Lock. The root password is the one set in Configurator.
  • The service won’t start and port 3306 is busy: another MySQL or a bundle like XAMPP already uses it. Find the process: Get-NetTCPConnection -LocalPort 3306 Then stop the other server, or run Configurator again and choose another port.
  • VCRUNTIME140.dll was not found or a missing DLL: install the Microsoft Visual C++ Redistributable (x64), then start the MSI again.
  • Plugin 'mysql_native_password' is not loaded: an old app or driver uses the old sign-in method. Update the driver. Move the old user account to the new method with ALTER USER … IDENTIFIED WITH caching_sha2_password BY … and a new password.

If you also work on a Mac

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

System Junk in MacWashing finds the caches of every app it knows, including those hidden inside app data, plus logs, Xcode junk and leftovers of deleted apps. It shows how much each takes and clears them in one go. Anything debatable stays unchecked until you decide.

Free trial · macOS 14 or later

Questions and answers

How do I install MySQL on Windows 11?

Download the MSI from dev.mysql.com/downloads/mysql, install it, then set the root password and the Windows service in MySQL Configurator. Add the bin folder to PATH to use mysql in Terminal.

Where does MySQL keep its data on Windows?

The programs are in C:\Program Files\MySQL\MySQL Server 8.4. The databases and the my.ini settings file are in C:\ProgramData\MySQL\MySQL Server 8.4, a hidden folder.

How do I change MySQL settings after installing?

Open MySQL Configurator from the Start menu again. It asks for the root password and lets you change the port, the service and other settings. You can also edit my.ini and restart the service.