Saturday, 1 June 2013

Multiple instances of MySQL with single installation in Windows

Specify options for each server in separate files and use --defaults-file when you install the services to tell each server what file to use. In this case, each file should list options using a [mysqld] group.
With this approach, to specify options for the 5.0.92 mysqld-nt, create a file C:\my-opts1.cnf that looks like this:
[mysqld]
basedir = C:/mysql-5.0.92
port = 3307
enable-named-pipe
socket = mypipe1
For the 5.1.71 mysqld, create a file C:\my-opts2.cnf that looks like this:
[mysqld]
basedir = C:/mysql-5.1.71
port = 3308
enable-named-pipe
socket = mypipe2

Install the services as follows (enter each command on a single line):
C:\> C:\mysql-5.0.92\bin\mysqld --install mysqld1 --defaults-file=C:\my-opts1.cnf
C:\> C:\mysql-5.1.71\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.

No comments:

Post a Comment