How to Install and Configure MySQL on a Windows Server

December 12, 2024

Introduction

MySQL is a well-established relational database management system (RDBMS). It is fully compatible with Windows operating systems, including desktop and server editions.

Learn how to install and configure MySQL on a Windows server using the MySQL MSI Installer and MySQL Configurator, tools designed to simplify the setup of MySQL products.

Guide on how top install and configure MySQL on Windows.

Prerequisites

  • Windows operating system.
  • Administrator privileges on the Windows server.

How to Install MySQL on Windows

Instead of downloading and installing MySQL manually, you can use the MSI Installer to streamline the process.

Step 1: Download MySQL MSI Installer for Windows

To download a free Community MySQL Server for Windows:

1. Connect to your Windows server and navigate to the official MySQL downloads page.

2. Use the dropdown menu to select the latest MySQL Server version. At the time of writing, the latest stable MySQL Community Server version is 8.4.3 LTS.

3. Download the MSI Installer.

Download MSI Installer form official MySQL page.

4. If you do not want to sign up for an Oracle Web Account, click No thanks, just start my download.

Start MySQL MSI Installer download.

Once the download is complete, run the MySQL Installer file from the download folder. It can take a few moments while Windows prepares the installation and configuration process.

Step 2: Install MySQL Server on Windows

To install MySQL Server on Windows:

1. Click Next to start the MySQL installation process in the Setup Wizard.

Start MySQL Setup Wizard.

2. Review and accept the License Agreement terms and click Next.

Accept MySQL License Agreement.

3. Before proceeding with the installation, define which features to install by selecting a Setup Type. Select one of the predefined options or create your custom setup:

  • Typical. Deploy an instance of the MySQL Server and skip most other features. Typically used for deploying servers in a production environment.
  • Custom. Manually select the elements to be installed and modify default settings.
  • Complete. Install MySQL Server and all available features, including sample databases and examples. Provides a complete environment for development and server management.

For this tutorial, we selected the Typical setup type. After making your selection, click Next to proceed.

Select MySQL Server setup type on Windows.

Note: The setups are tailored for specific use cases, primarily to streamline the installation. You can always customize the preconfigured setups post-installation.

4. Click Install to initiate the MySQL Server installation.

Install the MySQL Server on Windows.

5. Confirm the Run MySQL Configurator option is checked and click Finish.

Complete MySQL Server installation and launch MySQL Configurator.

This launches the MySQL Configurator app to assist you in configuring MySQL Server 8.4.3.

Step 3: Configure MySQL Server on Windows

The following section explains how to set up MySQL Server on Windows using the MySQL Configurator.

Note: The MySQL Configurator is part of the MySQL bundle and does not need to be installed separately. It automates the MySQL Server setup, provides a consistent interface across all supported Windows platforms, and resolves software dependencies.

The tool starts automatically if the Run MySQL Configurator option is selected during installation. If it does not launch, open the tool manually from the Windows Start menu.

Start MySQL Server configuration on Windows.

Once the tool is launched, click Next to begin the configuration process.

Data Directory

Select the directory where MySQL Server will store its data.

Use the default path, C:\ProgramData\MySQL\MySQL Server 8.4\, or specify a custom directory and click Next.

Select MySQL Data Directory path.

Note: To avoid path conflicts during the installation, remove previous MySQL versions from the system or select a new installation directory.

Type and Networking

In the Type and Networking section:

1. Choose one of three server configuration types in the Config Type dropdown:

  • Development Computer. Select this option if the Windows server is a testing and development environment where MySQL needs to share resources with other applications.
  • Server Computer. This configuration balances resource sharing and server performance. The Windows server can host multiple applications, including MySQL, as part of a multi-purpose server setup.
  • Dedicated Computer. MySQL utilizes all system resources with minimal resource sharing. This option is best used for dedicated MySQL servers and is optimized for production environments.

2. (Optional) Define the MySQL server port. The default port is 3306, but it can be changed if, for example, another application already uses this port number.

3. Ensure the Open Windows Firewall ports for network access option is checked to allow MySQL traffic through the firewall.

Set MySQL port number in Windows.

4. (Optional) Check the Show Advanced and Logging Option box to configure additional logging options later.

5. Click Next to continue.

Enable MySQL logging in Windows.

Accounts and Roles

The Accounts and Roles section allows you to configure MySQL user accounts. This is only an initial setup, and you can change the MySQL root password after the installation.

1. Enter and confirm a strong password for the MySQL root user.

2. (Optional) Click Add User to create additional roles and set privileges for various users and purposes.

3. Select Next to continue with the server configuration.

Set MySQL accounts and roles on Windows server.

Windows Service

A Windows Service is registered with the operating system and starts automatically when Windows boots. Configuring MySQL Server as a Windows Service ensures it runs continuously in the background and is available for applications.

Confirm the Configure MySQL Server as a Windows Service and Start the MySQL Server as System Startup options are checked, then click Next to proceed.

Configure MySQL as Windows Service.

Server File Permissions

File permissions determine how users access and interact with MySQL server files. To define file permissions for previously created MySQL users, you can:

  • Allow the MySQL Installer to configure user permissions automatically.
  • Manually set specific file access levels for each user (recommended).
  • Modify the server permissions manually after the installation is complete.

The recommended option is the safe choice for most setups. When ready, click Next to continue.

Set MySQL Server file permissions during Windows installation.

Logging Options (Optional)

If you have selected the Show Advanced Logging option in the Type and Networking tab, you can set up MySQL log preferences.

Select the types of logs you want to activate and define the log directories for:

  • Error Log. Logs critical errors and warnings encountered by the MySQL server.
  • General Log. Tracks server activity and connections.
  • Slow Query Log. Identifies queries that take longer than expected to execute.
  • Bin Log. Records all changes to the database data.

Click Next to proceed to the Advanced Options section.

MySQL logging option during installation on Windows.

Advanced Options (Optional)

The Advanced Options are available only if you have checked Show Advanced Options in the Type and Networking tab.

The Server ID setting allows you to set a unique server identifier, which is useful for distinguishing servers in multi-server environments.

You can also configure Table Names Case sensitivity. In Windows, MySQL treats table names as lowercase (case-insensitive) by default. Uppercase names are rarely used but can be set to align with specific cross-platform requirements.

Advanced options during MySQL installation on Windows.

Click Next to finalize the MySQL Server configuration.

Sample Databases

The Sample Databases tab allows you to create predefined sample databases and example code, which are useful for learning, testing, and development purposes.

Select the Sakila or World database (or both) and click Next.

Add sample databases when installing MySQL on Windows.

Apply Server Configuration

To complete the MySQL Server configuration:

1. Review the steps and click Execute to apply the configuration.

Review and execute MySQL configuration in Windows.

2. The system informs you the MySQL Server configuration process is complete and displays a summary of the completed configuration steps. Select Next to continue the installation process.

Apply MySQL configuration in Windows.

3. (Optional) Copy the installation process log to the Windows Clipboard.

4. Click Finish to complete the MySQL server installation on Windows.

Finish MySQL setup on Windows server.

Step 4: Verify MySQL Installation on Windows

If you configured MySQL as a Windows service, it starts automatically. To verify that the server is running:

1. Open the MySQL Command Line Client from the Windows Start menu.

Open the MySQL client form Windows start menu.

2. Enter the root password created during setup to access the MySQL server.

Enter MySQL root password to connect to server.

3. Use the following command to list the current databases:

SHOW DATABASES;
Show list of MySQL databases.

The output shows that the example databases, Sakila and World, were successfully created during the setup process.

Restart MySQL Service on Windows

If MySQL does not start automatically on boot:

1. Type Services in the Start menu and select Run as administrator.

Run Windows Services app as administrator.

2. Locate the MySQL service in the list. In this example, the service is listed as MySQL84.

3. Select the service and click Start or Restart, depending on its status.

Restart MySQL Service in Windows.

4. To ensure the MySQL service always starts on boot, right-click the service and select Properties.

5. In the Startup Type dropdown, select Automatic and click OK to save the changes.

Set MySQL to boot automatically on Windows.

The changes take effect immediately.

Conclusion

You have successfully installed MySQL on a Windows server. The setup options were significantly easier to navigate using the MySQL MSI Installer and the MySQL Configurator.

Aside from using the MySQL Client, there are several different ways to connect to a MySQL database in Windows.

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How to Improve MySQL Performance With Tuning
April 25, 2024

How to Improve MySQL Performance With Tuning
Read more
How To Create New MySQL User and Grant Privileges
July 18, 2024

This article explains how to create a new MySQL non-root user and grant various types of privileges.
Read more
How to Allow MySQL Remote Connections
July 4, 2024

This guide explains how to modify settings in the MySQL configuration file on the remote server and enable remote connections.
Read more
Database Server Price: What's the Cost of a Database Server?
December 12, 2024

This article will help you understand the different factors that impact the database server price. Read on to learn how much a typical database server costs and what to consider when calculating your server's price.
Read more