List:General Discussion« Previous MessageNext Message »
From:Nitin Mehta Date:May 11 2010 10:19am
Subject:Re: starting multiple instances with mysqld_multi
View as plain text  
Thanks, Prabhat! You're very right, but did you read the questions I asked?

From: Prabhat Kumar <aim.prabhat@stripped>
To: Nitin Mehta <ntnmht@stripped>
Cc: mysql@stripped
Sent: Tue, May 11, 2010 11:54:22 AM
Subject: Re: starting multiple instances with mysqld_multi


You can run multiple instances on the same host and specify configuration options either
by adding the options as arguments on the command line, or by storing them in
configuration files.

for example, from the command line:

shell> mysqld --port 3306 --log=/path/to/server1/log
shell> mysqld --port 3307 --log=/path/to/server2/log

So, when MySQL starts up it reads various config files in sequence. This means that you
can set global options for all instances in one file and then specific options for
individual instances in separate files.

The files it reads by default are (on linux)

You can direct the server to read specific config files after it reads the default
/etc/my.cnf file with the following directive.


So, if you wanted 2 instances running with some shared options and some specific options,
you could create additional configuration files in /etc say:


where my.server1.cnf has the following lines:

(other options here)

and my.server2.cnf is:

(other options here)

then you could start the separate instances of mysqld as follows:

shell> mysqld --defaults-extra-file=/etc/my.server1.cnf
shell> mysqld --defaults-extra-file=/etc/my.server2.cnf

about mysqld_multi
>>mysqld_multi [ options] {start| stop| report} [ server_id]
>Use this to run multiple MySQL servers on different socket files and ports. To set up
>multiple servers, a different section of server options must be entered into a
configuration file (e.g., /etc/my.cnf). The naming scheme for each section must be
>>where n is a different number for each server. Options must be entered separately
>each server in its own section, even when servers use the same options. At a minimum,
>each server should use a different socket file and a different TCP/IP port. To see an
>>example of how a configuration file might be set up for multiple servers, enter
>following from the command line:
>mysqld_multi --example
>Once multiple servers have been configured, to start a server, you can enter something
>>like the following from the command line:
>mysqld_multi start 3
>This line would start server number 3 listed in the configuration file as [mysqld3].
>entering report for the first argument, you can obtain the status on the server. For
>>starting and stopping the server, this script uses the mysqladmin utility. Here is
>alphabetical list of options specific to mysqld_multi that you can enter from the
>command line, along with a brief explanation of each:
>Specifies the path and name of the server’s configuration file if it is
different from
>the default.
>Displays a sample configuration file.
>Displays basic help information.
>Sets the path and name of the logfile. The default is /tmp/mysqld_multi.log.
>Sets the path to the mysqladmin utility.
>Specifies the path to mysqld.
>>Instructs the utility not to save messages to a log, but to send them to stdout
>Provides the password for using mysqladmin.
>Enables TCP/IP communication with the server instead of using a Unix-domain
>Provides the username for using mysqladmin. The same user must be used for all
>Displays the version of the utility.

On Tue, May 11, 2010 at 9:54 AM, Nitin Mehta <ntnmht@stripped> wrote:

>>I am exploring multiple instances with MySQL which will be running using the same
set of binaries (single MySQL base). Two things which I'm not able to work out are -
>>        1. Why mysqld_multi stop <grp_id> doesn't work? Well, I know why it
doesn't because there is nothing in the script to handle a 'stop' call; the actual
question would be - why it doesn't work when it is mentioned in the MySQL reference
>        2. how to (auto) restart the instances after a server restart? do I need to
write my own script for this or is there anything available which I'm not aware of?
>>If you have resolved these issues, please let me know.
>>Best Regards,

Best Regards,

Prabhat Kumar
Datavail-India Mumbai
Mobile     : 91-9987681929

My Blog:
My LinkedIn:

starting multiple instances with mysqld_multiNitin Mehta11 May
  • Re: starting multiple instances with mysqld_multiPrabhat Kumar11 May
    • Re: starting multiple instances with mysqld_multiNitin Mehta11 May
  • Re: starting multiple instances with mysqld_multiYang Wang14 May