The first part is to build multiple MySQL services on a server.
One, Introduction
In MySQL, there is a mysqld_multi command, can be used in a physical server to run multiple MySQL services, today reference some documents, personally tested and passed, really happy, now the operation of the process to share to everyone!
Operating system: Linux 2.6.13 (Slackware), other Linux should also be similar.
Database: Mysql 4.0.17 source program installation (I believe the latest 5.1.* is also similar, try again some days)
Planning: Running 4 MySQL services:
Assume server name: Db-app (IP is 192.168.0.100),
Assume server name: DB-APP2 (IP is 192.168.0.101),
The following is the second part, which tells about MySQL in Db-app,
Second, prepare
With the MySQL source program installed, assuming the installation of Configura with the choice of chlorine?
./configure--prefix=/usr/local/mysql--datadir=/usr/local/mysql/data1--sysconfdir=/etc
Note:--prefix will install MySQL to/usr/local/mysql,
--datadir Build the database/usr/local/mysql/data1
Sysconfdir is the search path for the MY.CNF configuration file that specifies that MySQL uses as/etc
Other MySQL installation process slightly.
As mentioned in the MySQL management manual: Each MySQL service can be standalone, so it calls a different startup option in a MY.CNF-the GNR value mentioned below, the use of different ports, the generation of the respective sockets file, and the service database is independent ( For more access to the official MySQL website English Management manual.
Mysqld_multi is a service process that manages multiple mysqld, and these service process programs have different UNIX sockets or are listening on different ports. He can start, stop, and monitor the current service status.
----program searches for [mysqld#] segments in MY.CNF (or in--config-file custom profiles), "#" can be any positive integer. This positive integer is the sequence of segments mentioned below, that is, the GNR. The sequence number of the segment is mysqld_multi to distinguish the different segments so that you can control the start, stop, or get his report information for a particular mysqld process. The parameters in these groups are the same as the parameters of the group needed to start a mysqld. However, if you are using multiple services, you must specify a UNIX socket or port for each service (excerpted from http://mifor.4dian.org using the Mysqld_multi program to manage multiple MySQL services).
From the above text you can see that the most important thing in the MySQL service is the my.cnf configuration file.
Now I post my my.cnf file.-----------------------
[Mysqld_multi]
Mysqld =/usr/local/mysql/bin/mysqld_safe
Mysqladmin =/usr/local/mysql/bin/mysqladmin