mysqld_multi − manage multiple MySQL servers


mysqld_multi [options] {start|stop|report} [GNR[,GNR] ...]


mysqld_multi is designed to manage several mysqld processes that listen for connections on different Unix socket files and TCP/IP ports. It can start or stop servers, or report their current status. The MySQL Instance Manager is an alternative means of managing multiple servers (see mysqlmanager(8)).

mysqld_multi searches for groups named [mysqldN] in my.cnf (or in the file named by the −−config−file option). N can be any positive integer. This number is referred to in the following discussion as the option group number, or GNR. Group numbers distinguish option groups from one another and are used as arguments to mysqld_multi to specify which servers you want to start, stop, or obtain a status report for. Options listed in these groups are the same that you would use in the [mysqld] group used for starting mysqld. (See, for example, Section, “Starting and Stopping MySQL Automatically”.) However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number. For more information on which options must be unique per server in a multiple−server environment, see Section 5.6, “Running Multiple MySQL Servers on the Same Machine”.

To invoke mysqld_multi, use the following syntax:

shell> mysqld_multi [options] {start|stop|report} [GNR[,GNR] ...]

start, stop, and report indicate which operation to perform. You can perform the designated operation for a single server or multiple servers, depending on the GNR list that follows the option name. If there is no list, mysqld_multi performs the operation for all servers in the option file.

Each GNR value represents an option group number or range of group numbers. The value should be the number at the end of the group name in the option file. For example, the GNR for a group named [mysqld17] is 17. To specify a range of numbers, separate the first and last numbers by a dash. The GNR value 10−13 represents groups [mysqld10] through [mysqld13]. Multiple groups or group ranges can be specified on the command line, separated by commas. There must be no whitespace characters (spaces or tabs) in the GNR list; anything after a whitespace character is ignored.

This command starts a single server using option group [mysqld17]:

shell> mysqld_multi start 17

This command stops several servers, using option groups [mysqld8] and [mysqld10] through [mysqld13]:

shell> mysqld_multi stop 8,10−13

For an example of how you might set up an option file, use this command:

shell> mysqld_multi −−example

As of MySQL 5.1.18, mysqld_multi searches for option files as follows:

• With −−no−defaults, no option files are read.

• With −−defaults−file=file_name, only the named file is read.

• Otherwise, option files in the standard list of locations are read, including any file named by the −−defaults−extra−file=file_name option, if one is given. (If the option is given multiple times, the last value is used.)

Before MySQL 5.1.18, the preceding options are not recognized. Files in the standard locations are read, and any file named by the −−config−file=file_name option, if one is given. A file named by −−config−file is read only for [mysqldN] option groups, not the [mysqld_multi] group.

Option files read are searched for [mysqld_multi] and [mysqldN] option groups. The [mysqld_multi] group can be used for options to mysqld_multi itself. [mysqldN] groups can be used for options passed to specific mysqld instances.

As of MySQL 5.1.35, the [mysqld] or [mysqld_safe] groups can be used for common options read by all instances of mysqld or mysqld_safe. You can specify a −−defaults−file=file_name option to use a different configuration file for that instance, in which case the [mysqld] or [mysqld_safe] groups from that file will be used for that instance. Before MySQL 5.1.35, some versions of mysqld_multi pass the −−no−defaults options to instances, so these techniques are inapplicable.

mysqld_multi supports the following options.


Display a help message and exit.


As of MySQL 5.1.18, this option is deprecated. If given, it is treated the same way as −−defaults−extra−file, described earlier. −−config−file is removed in MySQL 5.5.

Before MySQL 5.1.18, this option specifies the name of an extra option file. It affects where mysqld_multi looks for [mysqldN] option groups. Without this option, all options are read from the usual my.cnf file. The option does not affect where mysqld_multi reads its own options, which are always taken from the [mysqld_multi] group in the usual my.cnf file.


Display a sample option file.


Specify the name of the log file. If the file exists, log output is appended to it.


The mysqladmin binary to be used to stop servers.


The mysqld binary to be used. Note that you can specify mysqld_safe as the value for this option also. If you use mysqld_safe to start the server, you can include the mysqld or ledir options in the corresponding [mysqldN] option group. These options indicate the name of the server that mysqld_safe should start and the path name of the directory where the server is located. (See the descriptions for these options in mysqld_safe(1).) Example:

mysqld = mysqld−debug
ledir = /opt/local/mysql/libexec


Print log information to stdout rather than to the log file. By default, output goes to the log file.


The password of the MySQL account to use when invoking mysqladmin. Note that the password value is not optional for this option, unlike for other MySQL programs.


Silent mode; disable warnings.


Connect to each MySQL server via the TCP/IP port instead of the Unix socket file. (If a socket file is missing, the server might still be running, but accessible only via the TCP/IP port.) By default, connections are made using the Unix socket file. This option affects stop and report operations.


The user name of the MySQL account to use when invoking mysqladmin.


Be more verbose.


Display version information and exit.

Some notes about mysqld_multi:

Most important: Before using mysqld_multi be sure that you understand the meanings of the options that are passed to the mysqld servers and why you would want to have separate mysqld processes. Beware of the dangers of using multiple mysqld servers with the same data directory. Use separate data directories, unless you know what you are doing. Starting multiple servers with the same data directory does not give you extra performance in a threaded system. See Section 5.6, “Running Multiple MySQL Servers on the Same Machine”.

Make sure that the data directory for each server is fully accessible to the Unix account that the specific mysqld process is started as. Do not use the Unix root account for this, unless you know what you are doing. See Section 5.3.6, “How to Run MySQL as a Normal User”.

• Make sure that the MySQL account used for stopping the mysqld servers (with the mysqladmin program) has the same user name and password for each server. Also, make sure that the account has the SHUTDOWN privilege. If the servers that you want to manage have different user names or passwords for the administrative accounts, you might want to create an account on each server that has the same user name and password. For example, you might set up a common multi_admin account by executing the following commands for each server:

shell> mysql −u root −S /tmp/mysql.sock −p
Enter password:
−> TO ´multi_admin´@´localhost´ IDENTIFIED BY ´multipass´;

See Section 5.4, “The MySQL Access Privilege System”. You have to do this for each mysqld server. Change the connection parameters appropriately when connecting to each one. Note that the host name part of the account name must allow you to connect as multi_admin from the host where you want to run mysqld_multi.

• The Unix socket file and the TCP/IP port number must be different for every mysqld. (Alternatively, if the host has multiple network addresses, you can use −−bind−address to cause different servers to listen to different interfaces.)

• The −−pid−file option is very important if you are using mysqld_safe to start mysqld (for example, −−mysqld=mysqld_safe) Every mysqld should have its own process ID file. The advantage of using mysqld_safe instead of mysqld is that mysqld_safe monitors its mysqld process and restarts it if the process terminates due to a signal sent using kill −9 or for other reasons, such as a segmentation fault. Please note that the mysqld_safe script might require that you start it from a certain place. This means that you might have to change location to a certain directory before running mysqld_multi. If you have problems starting, please see the mysqld_safe script. Check especially the lines:

# Check if we are starting this relative (for the binary release)
if test −d $MY_PWD/data/mysql −a \
−f ./share/mysql/english/errmsg.sys −a \
−x ./bin/mysqld

The test performed by these lines should be successful, or you might encounter problems. See mysqld_safe(1).

• You might want to use the −−user option for mysqld, but to do this you need to run the mysqld_multi script as the Unix root user. Having the option in the option file doesn´t matter; you just get a warning if you are not the superuser and the mysqld processes are started under your own Unix account.

The following example shows how you might set up an option file for use with mysqld_multi. The order in which the mysqld programs are started or stopped depends on the order in which they appear in the option file. Group numbers need not form an unbroken sequence. The first and fifth [mysqldN] groups were intentionally omitted from the example to illustrate that you can have “gaps” in the option file. This gives you more flexibility.

# This file should probably be in your home dir (~/.my.cnf)
# or /etc/my.cnf
# Version 2.1 by Jani Tolonen
mysqld = /usr/local/bin/mysqld_safe
mysqladmin = /usr/local/bin/mysqladmin
user = multi_admin
password = multipass
socket = /tmp/mysql.sock2
port = 3307
pid−file = /usr/local/mysql/var2/hostname.pid2
datadir = /usr/local/mysql/var2
language = /usr/local/share/mysql/english
user = john
socket = /tmp/mysql.sock3
port = 3308
pid−file = /usr/local/mysql/var3/hostname.pid3
datadir = /usr/local/mysql/var3
language = /usr/local/share/mysql/swedish
user = monty
socket = /tmp/mysql.sock4
port = 3309
pid−file = /usr/local/mysql/var4/hostname.pid4
datadir = /usr/local/mysql/var4
language = /usr/local/share/mysql/estonia
user = tonu
socket = /tmp/mysql.sock6
port = 3311
pid−file = /usr/local/mysql/var6/hostname.pid6
datadir = /usr/local/mysql/var6
language = /usr/local/share/mysql/japanese
user = jani

See Section, “Using Option Files”.


Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.

This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see


For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at


Sun Microsystems, Inc. (

More Linux Commands

keyctl_get_security_alloc(3) - Retrieve a key's security con
keyctl_get_security() retrieves the security context of a key as a NUL-terminated string. This will be rendered in a form appropriate to the LSM in force - for

shlock(1) - Create lock files for use in shell scripts......
shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the process ID from the file an

java-java-1.6.0-openjdk(1) - the Java application launcher
The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that classs main method.

ldap_modrdn_s(3) - Perform an LDAP modify RDN operation.....
The ldap_modrdn() and ldap_modrdn_s() routines perform an LDAP modify RDN operation. They both take dn, the DN of the entry whose RDN is to be changed, and newr

winwstr(3ncurses) - get a string of wchar_t characters from
These routines return a string of wchar_t characters in wstr, extracted starting at the current cursor position in the named window. Attributes are stripped fro

mysqldumpslow(1) - Summarize slow query log files (ManPage)
The MySQL slow query log contains information about queries that take a long time to execute (see Section 5.2.5, The Slow Query Log). mysqldumpslow parses MySQL

cfsetspeed(3) - get and set terminal attributes, line contro
The termios functions describe a general terminal interface that is provided to control asynchronous communications ports. The termios structure Many of the fun

vpddecode(8) - VPD structure decoder - Linux manual page....
vpddecode prints the vital product data information that can be found in almost all IBM and Lenovo computers. Available items are: * BIOS Build ID * Box Serial

tk_setPalette(n) - Modify the Tk color palette (Man Page)...
The tk_setPalette procedure changes the color scheme for Tk. It does this by modifying the colors of existing widgets and by changing the option database so tha

Tk_CreateItemType(3) - define new kind of canvas item.......
Tk_CreateItemType is invoked to define a new kind of canvas item described by the typePtr argument. An item type corresponds to a particular value of the type a

FcMatrixEqual(3) - Compare two matrices - Linux manual page
FcMatrixEqual compares matrix1 and matrix2 returning FcTrue when they are equal and FcFalse when they are not. VERSION Fontconfig version 2.8.0 FcMatrixEqual.3

gnutls_hex2bin(3) - API function (Library - Linux man page)
Convert a buffer with hex data to binary data. RETURNS GNUTLS_E_SUCCESS on success, otherwise a negative error code. SINCE 2.4.0 REPORTING BUGS Report bugs to <

We can't live, work or learn in freedom unless the software we use is free.