Home > database >  Windows instantiated multiple mysql
Windows instantiated multiple mysql

Time:11-07

1. By running the first mysql mysql package installation
Website https://dev.mysql.com/downloads/mysql/to download free version of the installation package

2. Under the specified installation directory decompress compressed package (as shown in figure I select the folder to create a mysql on disk C, to create a 3306 a folder to store the first instance to the mysql data)

After unzip the files as shown in figure (data file to initialize automatically generated when the user, it contains the information such as root)
3. Need to manually add my. Ini (following)
 
[client]# set the mysql client default ports used for connection to the server
Port=3306
Default - character - set=utf8
[mysqld]
# service tag
Server_id=1
# set port 3306
Port=3306
# server character set the default use 8 bits for coding the latin1 character set
Character - set - server=utf8
# set the mysql installation directory
Basedir=C: \ MYSQL \ 3306 \ MYSQL - 5.7.31 - winx64
# set the mysql database data storage directory
Datadir=C: \ MYSQL \ 3306 \ MYSQL - 5.7.31 - winx64 \ data
Sql_mode=STRICT_TRANS_TABLES, NO_ENGINE_SUBSTITUTION
# to allow maximum number of connections
Max_connections=200
# to create a new table will use the default storage engine
Default - storage - engine=INNODB
# default "mysql_native_password" plug-in authentication
# mysql_native_password
Default_authentication_plugin=mysql_native_password
[mysql]
# set the mysql client default character set
Default - character - set=utf8
[WinMySQLADmin]
C: \ MYSQL \ 3306 \ MYSQL - 5.7.31 - winx64 \ bin \ mysqld exe

4. Will the MySQL configuration to the system environment variable path
4.1. Add MySQL environment variable

4.2. MySQL is added to the path environment variable

5. If the install MySQL need to uninstall MySQL; Uninstall command: sc delete mysql

6. Remove the MySQL registry information, running regedis, start the registry

HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Application/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/Services/Eventlog/Application/MySQL (may not have this directory)
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Application/MySQL (may not have this directory)
Uninstall Mysql aspects has been completed!
7. Registered MySQL service

7.1. In the MySQL installation directory, add a file to my. Ini, and the configuration of resources step 3
7.2. Use the administrator to start the CMD command, enter the MySQL installation directory under the bin directory of the input according to the following screenshots to perform

Description:

Mysqld -- the initialize - insecure: in the MySQL installation directory automatically create a data folder, and create a MySQL database by default, automatically generated password-less root

Mysqld -- the initialize: you must first create the data folder, to execute the commands, and generates a user with random initialization code

Mysqld install: registered MySQL service

Net start mysql: start the service

Net stop mysql: stop service

Mysql -u root: first password-less logins operation



Began to create a second mysql instance objects below
1. 3306 folders, replicate, paste of 3307330 8 (pictured), such as

2. Modification of my in 3307. Ini (this in 3307, for example the rest can be copied)

Server_id can be changed to 2, and fully replace 3306 to 3307
3. The system of registered famous called MYSQL3307 service name: mysqld install MYSQL3307 - defaults - file="C: \ MYSQL \ 3307 \ MYSQL - 5.7.31 - winx64 \ my ini"
4. After the registration into system services, start is colleagues will be unable to start in 3306 and 3307, found that the second MySQL service or the path to start the service in accordance with the first path, unable to perform the C: \ MySQL \ 3307 \ MySQL - 5.7.31 - winx64 \ bin \ mysqld program
5. Modify the registry to use regedit command search start registry
Find the second MySQL service registration folder: \ HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ MYSQL3307, modify the ImagePath data values for the MySQL service corresponding installation path

6. A great work done can start the service


FAQ summary
1. In the other blog found initialized mysql data of 3307


When performing this step will appear the initialize specified but the data directry from the files in
Mean to instantiate existing mysql... Giant pit here,,,, my final operations are separated in the past this one, and don't have to initialize, because copy of 3306 folders already contains initialization data
2.3306 and 3307 two instances cannot be colleagues start, (without modify the registry, start as a service address all point to the 3306)


Have two days, and make a summary, and would like to see who can the smooth




  • Related