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
Execute service install command after initial password is logged
mysqld –install mysql_2
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
To log on after startup, the command is as follows:
mysql –uroot –P3308 –p
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)