content_image/817194.jpg
For the 8.0.25 mysqld , create a file C:\my-opts2.cnf  that looks like this: 

[mysqld] basedir = C:/mysql-8.0.25 port = 3308 enable-named-pipe socket = mypipe2 

Install the services as follows (enter each command on a single line): 

C:\> C:\mysql-5.7.9\bin\mysqld --install mysqld1 --defaults-file=C:\my-opts1.cnf C:\> C:\mysql-8.0.25\bin\mysqld --install mysqld2 --defaults-file=C:\my-opts2.cnf 

When you install a MySQL server as a service and use a --defaults-file  option, the service name must precede the option. 

After installing the services, start and stop them the same way as in the preceding example. 

To remove multiple services, use SC DELETE mysqld_service_name  for each one. Alternatively, use mysqld --remove  for each one, specifying a service name following the --remove  option. If the service name is the default ( MySQL ), you can omit it when using mysqld --remove . 

## 5.8.3 Running Multiple MySQL Instances on Unix 

<img src='content_image/817194.jpg'>

## Note 

The discussion here uses mysqld_safe  to launch multiple instances of MySQL. For MySQL installation using an RPM distribution, server startup and shutdown is managed by systemd on several Linux platforms. On these platforms, mysqld_safe  is not installed because it is unnecessary. For information about using systemd to handle multiple MySQL instances, see Section 2.5.9, “Managing MySQL Server with systemd” . 

One way is to run multiple MySQL instances on Unix is to compile different servers with different default TCP/IP ports and Unix socket files so that each one listens on different network interfaces. Compiling in different base directories for each installation also results automatically in a separate, compiled-in data directory, log file, and PID file location for each server. 

Assume that an existing 5.7 server is configured for the default TCP/IP port number (3306) and Unix socket file ( /tmp/mysql.sock ). To configure a new 8.0.25 server to have different operating parameters, use a CMake  command something like this: 

shell> cmake . -DMYSQL_TCP_PORT= port_number  \ -DMYSQL_UNIX_ADDR= file_name  \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-8.0.25 

Here, port_number  and file_name  must be different from the default TCP/IP port number and Unix socket file path name, and the CMAKE_INSTALL_PREFIX  value should specify an installation directory different from the one under which the existing MySQL installation is located. 

If you have a MySQL server listening on a given port number, you can use the following command to find out what operating parameters it is using for several important configurable variables, including the base directory and Unix socket file name: 

shell> mysqladmin --host= host_name  --port= port_number  variables 

