Installing multiple MySQL instances on Windows

Source: Internet
Author: User

In the process of learning and development, there are several MySQL databases, such as Master-slave cluster, sub-Library sub-table, the development phase of the installation of multiple MySQL instances on a single machine is very convenient.

Installing the MySQL section on the MySQL tutorial-basic article -1.1-windows is a detailed explanation of how to install a MySQL server on Windows with a compressed package, which is based on how to install multiple MySQL servers on Windows.

The first step : Unzip the package into separate directories.
I have installed an additional 3 MySQL instances after I have installed a MySQL instance, with the following paths:
C:\Program files\mysql\mysql2\mysql-5.7.10-winx64
C:\Program files\mysql\mysql3\mysql-5.7.10-winx64
C:\Program files\mysql\mysql4\mysql-5.7.10-winx64

Step Two : Modify the configuration file.
Rename the My-default.ini under the MYSQL2 directory to My.ini and make the following configuration to ensure that the port number and server_id are different.

Step three : Initialize and install.
Run cmd as administrator, and execute the Initialize command after entering the bin directory

mysqld--initialize--user=mysql--console
 
   
  
  • 1

Execute service install command after initial password is logged

mysqld –install mysql_2
 
   
  
  • 1

Note that here is the parameter mysql_2,mysql the installation command in the official document is Mysqld-install, the command under the Windows system default service name is MySQL, so in multi-instance installation must bring the service name parameter, and the parameter values are different, Otherwise, it is the same instance when you start the MySQL service.

Fourth Step : Modify the registry.
In the Start menu, enter the Regidit command to open the registry and locate services, HKEY_LOCAL_MACHINE, SYSTEM-I, CurrentControlSet, Mysql_ 2, when selected, changes the value of the ImagePath parameter to

"C:\Program files\mysql\mysql2\mysql-5.7.10-winx64\bin\mysqld" –defaults-file= "C:\Program files\mysql\mysql2\ Mysql-5.7.10-winx64\my.ini "mysql_2

Change the path to your own installation path. This step is important, when I install this parameter value defaults to the path of the first MySQL instance, and if you do not make a change it will also occur when multiple MySQL instances are actually running only one.

Fifth Step : Start the service and change the password.
Execute the command at the command line to start the MySQL service:

start mysql_2
 
   
  
  • 1

To log on after startup, the command is as follows:

mysql –uroot –P3308 –p
 
   
  
  • 1

The port number configured in the second step is 3308, and the MySQL login command connects to port 3306 by default, so take the parameter-p3308, note the uppercase P, and differentiate the lowercase p for the parameter that represents the password. After successful login, follow the tutorial in section 1.1 to change your password.

A second MySQL instance is installed after the previous step. Follow this procedure to install multiple MySQL instances on a single machine by configuring different ports, server_id, and service names for different MySQL instances.

Install multiple MySQL instances on Windows (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.