One Machine, Many MySQLs: The Art of Multi-Instance Setup on Windows

Blogs

Oracle Data Integrator : Getting Started with ODI Repositories
June 3, 2025
Getting Started with dbdemos: Supercharge Your Learning Experience on Databricks
June 11, 2025

One Machine, Many MySQLs: The Art of Multi-Instance Setup on Windows

Running multiple MySQL instances on a single Windows machine might sound complex, but it’s a powerful setup that can help developers, testers, and database administrators manage isolated environments efficiently. Whether you’re testing different MySQL configurations, supporting multiple applications, or simulating a production-like setup on your local system, having more than one MySQL server running simultaneously can be a game-changer.

In this blog, we’ll walk you through a step-by-step guide to install and configure multiple MySQL Server instances on a Windows machine. We’ll cover how to set up separate data directories, assign unique ports, configure my.ini files, and manage each instance as an independent Windows service. By the end, you’ll have a clean, organized multi-instance setup without needing multiple virtual machines or Docker containers.

Let’s get started!

 We can install a different version of MySQL but cannot install multiple instances of the same version. To run multiple instances, the second instance of MySQL must install as a windows service. The installation must be performed manually using a command prompt. We are using mysqld to install MySQL, and the step-by-step process is following.

  1. Create a new directory named MySQLDev in C: drive and copy the content of the MySQL base directory, data directory, and configuration file (my.ini) to the C: MySQLDev folder
  2. Rename the configuration file
  3. Update the configuration file by making the following changes
    1. Change the port
    2. Change the value of the base directory and the data directory
    3. Change the value of the named-pipe
  4. Start the manual installation of MySQL using the mysqld command. The installation uses the updated configuration file
  5. Start the service
  6. Connect to the new instance from MySQL workbench
  7. If required, change the password of the root user

Let us perform the installation. Open the command prompt using an administrator account. To do that, Right-click on the Command prompt and select Run as Administrator.

Create the directory and copy the files

First, create a new directory named MySQLDev on C:drive of the computer.

C:> mkdir MySQLDev

Copy the content of the MYSQL base directory to C:MySQLDev using the XCOPY command. If you have installed MySQL using default settings, the directory location is C:Program FilesMySQLMySQL Server XX. You can view the location of the base directory of the MySQL server from the Server Status screen of MySQL workbench.

C:> xcopy C:”Program Files”MySQL”MySQL Server XX″ C:MySQLDev /E /H

Once the subdirectories and files of the MySQL base directory are copied, copy the data directory and configuration file to the C:MySQLDev. The default location of the data directory is C:ProgramDataMySQLMySQL Server XXData.

XCOPY command to copy Data directory

C:> xcopy C:”ProgramData”MySQL”MySQL Server XX″data C:MySQLDevData /E /H

COPY Command to copy configuration file

C:>copy C:ProgramDataMySQL”MySQL Server XX″my.ini C:MySQLDev

Rename the configuration file

Change the name of the configuration file named my.ini to MyDev.ini using the REN command.

C:> ren C:MySQLDevmy.ini MyDev.ini

Change the parameters in the configuration file

Now, let us change the values of the configuration parameters in the MyDEV.ini file. We are making changes in the following parameters:

Save and close the configuration file.

Install MySQL using a new configuration file

To manually install MySQL as a Windows service, use mysqld command line utility. The command is the following:

C:> mysqld –install MySQLDEV –defaults-file=”C:MySQLDEVMyDEV.ini”

The service is installed successfully.

Once MySQL is installed as a windows service, let us start it.

Start MySQL instance

To start the service, open the control panel open Administrative Tools Open Services. In the Services console, you can see the MySQLDEV service is installed. Right-click on it and click on Start.

If the configuration is made correctly, then the service will be started successfully. Alternatively, you can start the MySQLDEV service by running the following command.

Once the service is started you can connect to the new server by providing respective names and port details, additionally you change the root password for the instance if needed.

Conclusion

Setting up multiple MySQL instances on a single Windows machine might seem intimidating at first, but with the right structure and configuration, it becomes a straightforward process. By isolating each instance with its own data directory, port, configuration file, and service name, you gain the flexibility to test different environments, run parallel applications, or simulate real-world multi-database scenarios — all on one system.

Thanks you for your time–do try this out!!!

 


Lochan R

Leave a Reply

Your email address will not be published. Required fields are marked *