Install MySQL on Windows
Learn how to download, install, configure, secure, and verify MySQL Community Server on Windows with MySQL Installer.
What you will install
MySQL Server is the local database service that stores data and processes SQL requests. The Windows installation normally uses MySQL Installer, an application that installs and configures MySQL products.
The usual sequence is:
- Download the Windows installer.
- Select a setup type and products.
- Install the program files.
- Configure the local server, network, authentication, and accounts.
- Create the MySQL Windows service.
- Verify that the service accepts authenticated connections.
MySQL Server is separate from optional tools. MySQL Workbench is a graphical client for SQL, schema design, and administration. MySQL Shell is an interactive command-line environment. Connectors let applications communicate with MySQL, while documentation and sample databases are optional learning or development components.
For background, see What Is MySQL.
Prerequisites and planning
Before installing, check the Windows requirements listed for the MySQL release you intend to use. Choose an installer compatible with your Windows version and system architecture, such as 64-bit Windows when that is the architecture of your computer.
- Use an account with administrator privileges. Installing services, writing protected folders, and installing dependencies commonly require elevation through User Account Control.
- Have adequate free disk space for the installer, program files, logs, and the data directory.
- Use an internet connection for the smaller web installer. Choose the full installer if the computer will be offline or if you want all selected packages available locally.
- Check whether MySQL or MariaDB is already installed. An existing service may already use the default service name or TCP port 3306.
- Back up existing data directories and configuration files before replacing, upgrading, or reconfiguring an installation. Do not assume that uninstalling a product preserves database data.
A data directory is the location where MySQL stores database files and related server data. Record its location before changing an existing installation.
Download MySQL for Windows
Use the official MySQL Downloads area and open the MySQL Community Server or MySQL Installer download page. Select the Windows installer package that matches your system and intended release.
The two common installer packages are:
- Web installer: a small download that retrieves the products you select during setup. It requires network access while installing.
- Full installer: a larger package containing the installation files needed for offline setup.
An Oracle account sign-in prompt may appear. Depending on the download flow, signing in may be optional; follow the available download option if you do not want to create or use an account.
Run MySQL Installer
- Locate the downloaded installer and launch it. Use an elevated administrator prompt or approve the User Account Control request when required.
- Accept the license terms after reading them.
- Allow the installer to check prerequisites and dependencies. If it offers to download or install a missing requirement, review the requirement and allow it when appropriate.
- Continue to the product-selection screen or setup-type screen.
Installation of program files and configuration of the database server are separate stages. A successful file installation does not by itself prove that the server is running.
Choose a setup type and components
Installer labels can vary between MySQL releases, but common choices include server-only, client-only, full, developer default, and custom.
For typical local development, choose a developer-oriented setup or a custom setup containing MySQL Server and MySQL Workbench. For a minimal database service, choose server-only. Use custom when you need exact control over connectors, Shell, documentation, or sample databases.
Review the selected products, versions, installation paths, and dependencies before continuing. Use the Install, Execute, or similarly named step to copy and register the selected components.
Configure MySQL Server
After product installation, the wizard configures the server instance. For a normal single-computer installation, select a standalone local server configuration rather than a configuration intended to join a larger server topology.
The wizard may present these categories:
- Server type or machine profile: balances memory and other resources for a development computer, dedicated server, or general-purpose machine.
- Connectivity: enables TCP/IP and sets the classic MySQL port.
- Authentication: selects the authentication method used to verify accounts.
- Accounts: creates the initial root password and optional additional users.
- Windows service: selects the service name, startup behavior, and service account.
- Apply configuration: writes settings, initializes the data directory, and starts or registers the service.
Exact screen names and defaults differ across MySQL versions. The important decisions remain the same: how the server communicates, how users authenticate, which administrator password is used, and how Windows runs the service.
Network settings and ports
TCP/IP is the networking protocol used by most MySQL client connections. The conventional port for classic MySQL connections is 3306.
- Leave TCP/IP enabled and retain port 3306 when it is unused.
- If another MySQL, MariaDB, or database process uses 3306, identify the conflict. Stop or reconfigure the unnecessary service, or choose another unused port such as 3307.
- Use the same port in Workbench, command-line clients, and application connection settings.
- For local-only development, do not open an inbound firewall port unnecessarily.
- If remote computers must connect, configure the firewall and server access deliberately. Opening a port increases exposure and should be limited to the required network sources.
Some installer versions offer advanced connection methods such as X Protocol on a separate port. Enable these only when a tool or application requires them.
Authentication and root security
root is the initial high-privilege MySQL administrative account. It is a MySQL account, not the same account as Windows Administrator.
- Create a long, unique root password.
- Store it in a password manager or another secure location.
- Select the recommended modern authentication method unless a specific application requires another supported method.
- Add limited administrative or application accounts when needed. Do not routinely configure applications to connect as root.
Authentication is the process of proving a user's identity to the server. The selected authentication method must be supported by the client or application that connects to MySQL.
Configure the Windows service
A Windows service is a background program managed by Windows. Running MySQL as a service allows it to start and stop through Windows service management.
- Choose a unique service name. A name such as
MySQL80is only an example; use a different name for separate instances. - Choose automatic startup if this is a regularly used local server. Choose manual startup if you want to run it only for specific projects.
- The default dedicated service account is generally appropriate. It gives the service a controlled Windows identity instead of requiring an interactive user account.
- Apply the configuration and wait for every action to report success.
If multiple instances exist, document each instance's service name, port, configuration file, and data directory so that they are not confused.
Verify the installation
Check the Windows service
Open PowerShell and query services whose names begin with MySQL:
Get-Service -Name MySQL*The exact service name depends on the value selected in the installer. Confirm that the intended service is running. If it is stopped, start it through Windows service management or investigate the startup error before trying clients.
Connect with a command-line client
If the MySQL client tools are installed and available in the command path, connect to the local server with:
mysql -u root -pEnter the root password when prompted. For a nondefault port, explicitly specify the TCP host and port:
mysql -h 127.0.0.1 -P 3307 -u root -plocalhost and 127.0.0.1 typically refer to the current computer. Using 127.0.0.1 explicitly requests a TCP connection.
Run harmless verification commands
Inside the MySQL client, run:
SELECT VERSION();
SHOW DATABASES;
CREATE DATABASE installation_test;
SHOW DATABASES;The first command displays the server version. The second lists databases. The third creates a temporary test database, and the final command confirms that it appears. Remove the test database when it is no longer needed:
DROP DATABASE installation_test;Connect with Workbench
In MySQL Workbench, create or open a connection and supply the host, port, user name, and password. For a typical local connection, use host localhost or 127.0.0.1, port 3306, and user root. If you chose another port, enter that port instead.
A successful Workbench connection followed by SELECT VERSION(); confirms both the server and client connection settings.
Practical installation examples
Typical local development
- Choose a developer-oriented or custom setup containing MySQL Server and Workbench.
- Keep TCP/IP enabled and retain 3306 if it is available.
- Create and securely save a strong root password.
- Register the server as an automatically started Windows service.
- Connect from Workbench to
localhostand verify the server version.
Minimal local database server
- Choose server-only.
- Configure the standalone server and install only the server components.
- Use the command-line client to connect locally and run
SELECT VERSION();.
Using an alternative port
- Confirm that port 3306 is occupied.
- Select an unused port during configuration.
- Use that port in Workbench, command-line commands, and application configuration.
- Record the port alongside the service name and data directory.
Post-installation guidance
The MySQL Installer can usually be opened later to add products, upgrade products, modify configuration, or remove products. Review its available actions before changing an existing instance.
Persistent server settings are commonly stored in my.ini, the Windows MySQL configuration file. Make a backup before editing it, change only settings you understand, and stop or restart the MySQL service as required for changes to take effect.
Create a non-root user for routine work and application connections. Use privileges appropriate to the task rather than granting every account full administrative access. Continue learning with Create a User, Create a Database, and Access MySQL.
Record these installation details:
- Installed MySQL version
- Windows service name
- Classic MySQL port
- Host name used for local connections
- Data directory location
- Location of the configuration file
Troubleshooting
Exam-relevant notes
- MySQL Server is the database service; Workbench and Shell are optional client tools.
- Port 3306 is the standard classic MySQL TCP port, but the configured port may differ.
- root is a MySQL administrative account and is distinct from Windows Administrator.
- A Windows service controls whether MySQL runs in the background and starts automatically.
localhostcommonly identifies the computer on which the server is installed.- Successful installation should be verified by checking the service and running an authenticated SQL query.