1MYSQLD_MULTI(1)              MySQL Database System             MYSQLD_MULTI(1)
2
3
4

NAME

6       mysqld_multi - manage multiple MySQL servers
7

SYNOPSIS

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

DESCRIPTION

12       mysqld_multi is designed to manage several mysqld processes that listen
13       for connections on different Unix socket files and TCP/IP ports. It can
14       start or stop servers, or report their current status. The MySQL
15       Instance Manager is an alternative means of managing multiple servers
16       (see mysqlmanager(8)).
17
18       mysqld_multi searches for groups named [mysqldN] in my.cnf (or in the
19       file named by the --config-file option).  N can be any positive
20       integer. This number is referred to in the following discussion as the
21       option group number, or GNR. Group numbers distinguish option groups
22       from one another and are used as arguments to mysqld_multi to specify
23       which servers you want to start, stop, or obtain a status report for.
24       Options listed in these groups are the same that you would use in the
25       [mysqld] group used for starting mysqld. (See, for example,
26       Section 2.12.1.2, “Starting and Stopping MySQL Automatically”.)
27       However, when using multiple servers, it is necessary that each one use
28       its own value for options such as the Unix socket file and TCP/IP port
29       number. For more information on which options must be unique per server
30       in a multiple-server environment, see Section 5.3, “Running Multiple
31       MySQL Instances on One Machine”.
32
33       To invoke mysqld_multi, use the following syntax:
34
35           shell> mysqld_multi [options] {start|stop|report} [GNR[,GNR] ...]
36
37       start, stop, and report indicate which operation to perform. You can
38       perform the designated operation for a single server or multiple
39       servers, depending on the GNR list that follows the option name. If
40       there is no list, mysqld_multi performs the operation for all servers
41       in the option file.
42
43       Each GNR value represents an option group number or range of group
44       numbers. The value should be the number at the end of the group name in
45       the option file. For example, the GNR for a group named [mysqld17] is
46       17. To specify a range of numbers, separate the first and last numbers
47       by a dash. The GNR value 10-13 represents groups [mysqld10] through
48       [mysqld13]. Multiple groups or group ranges can be specified on the
49       command line, separated by commas. There must be no whitespace
50       characters (spaces or tabs) in the GNR list; anything after a
51       whitespace character is ignored.
52
53       This command starts a single server using option group [mysqld17]:
54
55           shell> mysqld_multi start 17
56
57       This command stops several servers, using option groups [mysqld8] and
58       [mysqld10] through [mysqld13]:
59
60           shell> mysqld_multi stop 8,10-13
61
62       For an example of how you might set up an option file, use this
63       command:
64
65           shell> mysqld_multi --example
66
67       As of MySQL 5.1.18, mysqld_multi searches for option files as follows:
68
69       ·   With --no-defaults, no option files are read.
70
71       ·   With --defaults-file=file_name, only the named file is read.
72
73       ·   Otherwise, option files in the standard list of locations are read,
74           including any file named by the --defaults-extra-file=file_name
75           option, if one is given. (If the option is given multiple times,
76           the last value is used.)
77
78       Before MySQL 5.1.18, the preceding options are not recognized. Files in
79       the standard locations are read, and any file named by the
80       --config-file=file_name option, if one is given. A file named by
81       --config-file is read only for [mysqldN] option groups, not the
82       [mysqld_multi] group.
83
84       Option files read are searched for [mysqld_multi] and [mysqldN] option
85       groups. The [mysqld_multi] group can be used for options to
86       mysqld_multi itself.  [mysqldN] groups can be used for options passed
87       to specific mysqld instances.
88
89       As of MySQL 5.1.35, the [mysqld] or [mysqld_safe] groups can be used
90       for common options read by all instances of mysqld or mysqld_safe. You
91       can specify a --defaults-file=file_name option to use a different
92       configuration file for that instance, in which case the [mysqld] or
93       [mysqld_safe] groups from that file will be used for that instance.
94       Before MySQL 5.1.35, some versions of mysqld_multi pass the
95       --no-defaults options to instances, so these techniques are
96       inapplicable.
97
98       mysqld_multi supports the following options.
99
100       ·   --help
101
102           Display a help message and exit.
103
104       ·   --config-file=file_name
105
106           As of MySQL 5.1.18, this option is deprecated. If given, it is
107           treated the same way as --defaults-extra-file, described earlier.
108           --config-file is removed in MySQL 5.5.
109
110           Before MySQL 5.1.18, this option specifies the name of an extra
111           option file. It affects where mysqld_multi looks for [mysqldN]
112           option groups. Without this option, all options are read from the
113           usual my.cnf file. The option does not affect where mysqld_multi
114           reads its own options, which are always taken from the
115           [mysqld_multi] group in the usual my.cnf file.
116
117       ·   --example
118
119           Display a sample option file.
120
121       ·   --log=file_name
122
123           Specify the name of the log file. If the file exists, log output is
124           appended to it.
125
126       ·   --mysqladmin=prog_name
127
128           The mysqladmin binary to be used to stop servers.
129
130       ·   --mysqld=prog_name
131
132           The mysqld binary to be used. Note that you can specify mysqld_safe
133           as the value for this option also. If you use mysqld_safe to start
134           the server, you can include the mysqld or ledir options in the
135           corresponding [mysqldN] option group. These options indicate the
136           name of the server that mysqld_safe should start and the path name
137           of the directory where the server is located. (See the descriptions
138           for these options in mysqld_safe(1).) Example:
139
140               [mysqld38]
141               mysqld = mysqld-debug
142               ledir  = /opt/local/mysql/libexec
143
144       ·   --no-log
145
146           Print log information to stdout rather than to the log file. By
147           default, output goes to the log file.
148
149       ·   --password=password
150
151           The password of the MySQL account to use when invoking mysqladmin.
152           Note that the password value is not optional for this option,
153           unlike for other MySQL programs.
154
155       ·   --silent
156
157           Silent mode; disable warnings.
158
159       ·   --tcp-ip
160
161           Connect to each MySQL server through the TCP/IP port instead of the
162           Unix socket file. (If a socket file is missing, the server might
163           still be running, but accessible only through the TCP/IP port.) By
164           default, connections are made using the Unix socket file. This
165           option affects stop and report operations.
166
167       ·   --user=user_name
168
169           The user name of the MySQL account to use when invoking mysqladmin.
170
171       ·   --verbose
172
173           Be more verbose.
174
175       ·   --version
176
177           Display version information and exit.
178
179       Some notes about mysqld_multi:
180
181       ·   Most important: Before using mysqld_multi be sure that you
182           understand the meanings of the options that are passed to the
183           mysqld servers and why you would want to have separate mysqld
184           processes. Beware of the dangers of using multiple mysqld servers
185           with the same data directory. Use separate data directories, unless
186           you know what you are doing. Starting multiple servers with the
187           same data directory does not give you extra performance in a
188           threaded system. See Section 5.3, “Running Multiple MySQL Instances
189           on One Machine”.
190
191       ·
192
193               Important
194               Make sure that the data directory for each server is fully
195               accessible to the Unix account that the specific mysqld process
196               is started as.  Do not use the Unix root account for this,
197               unless you know what you are doing. See Section 6.1.5, “How to
198               Run MySQL as a Normal User”.
199
200       ·   Make sure that the MySQL account used for stopping the mysqld
201           servers (with the mysqladmin program) has the same user name and
202           password for each server. Also, make sure that the account has the
203           SHUTDOWN privilege. If the servers that you want to manage have
204           different user names or passwords for the administrative accounts,
205           you might want to create an account on each server that has the
206           same user name and password. For example, you might set up a common
207           multi_admin account by executing the following commands for each
208           server:
209
210               shell> mysql -u root -S /tmp/mysql.sock -p
211               Enter password:
212               mysql> GRANT SHUTDOWN ON *.*
213                   -> TO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';
214
215           See Section 6.2, “The MySQL Access Privilege System”. You have to
216           do this for each mysqld server. Change the connection parameters
217           appropriately when connecting to each one. Note that the host name
218           part of the account name must permit you to connect as multi_admin
219           from the host where you want to run mysqld_multi.
220
221       ·   The Unix socket file and the TCP/IP port number must be different
222           for every mysqld. (Alternatively, if the host has multiple network
223           addresses, you can use --bind-address to cause different servers to
224           listen to different interfaces.)
225
226       ·   The --pid-file option is very important if you are using
227           mysqld_safe to start mysqld (for example, --mysqld=mysqld_safe)
228           Every mysqld should have its own process ID file. The advantage of
229           using mysqld_safe instead of mysqld is that mysqld_safe monitors
230           its mysqld process and restarts it if the process terminates due to
231           a signal sent using kill -9 or for other reasons, such as a
232           segmentation fault. Please note that the mysqld_safe script might
233           require that you start it from a certain place. This means that you
234           might have to change location to a certain directory before running
235           mysqld_multi. If you have problems starting, please see the
236           mysqld_safe script. Check especially the lines:
237
238               ----------------------------------------------------------------
239               MY_PWD=`pwd`
240               # Check if we are starting this relative (for the binary release)
241               if test -d $MY_PWD/data/mysql -a \
242                  -f ./share/mysql/english/errmsg.sys -a \
243                  -x ./bin/mysqld
244               ----------------------------------------------------------------
245
246           The test performed by these lines should be successful, or you
247           might encounter problems. See mysqld_safe(1).
248
249       ·   You might want to use the --user option for mysqld, but to do this
250           you need to run the mysqld_multi script as the Unix superuser
251           (root). Having the option in the option file doesn't matter; you
252           just get a warning if you are not the superuser and the mysqld
253           processes are started under your own Unix account.
254
255       The following example shows how you might set up an option file for use
256       with mysqld_multi. The order in which the mysqld programs are started
257       or stopped depends on the order in which they appear in the option
258       file. Group numbers need not form an unbroken sequence. The first and
259       fifth [mysqldN] groups were intentionally omitted from the example to
260       illustrate that you can have “gaps” in the option file. This gives you
261       more flexibility.
262
263           # This file should probably be in your home dir (~/.my.cnf)
264           # or /etc/my.cnf
265           # Version 2.1 by Jani Tolonen
266           [mysqld_multi]
267           mysqld     = /usr/local/bin/mysqld_safe
268           mysqladmin = /usr/local/bin/mysqladmin
269           user       = multi_admin
270           password   = multipass
271           [mysqld2]
272           socket     = /tmp/mysql.sock2
273           port       = 3307
274           pid-file   = /usr/local/mysql/var2/hostname.pid2
275           datadir    = /usr/local/mysql/var2
276           language   = /usr/local/share/mysql/english
277           user       = john
278           [mysqld3]
279           socket     = /tmp/mysql.sock3
280           port       = 3308
281           pid-file   = /usr/local/mysql/var3/hostname.pid3
282           datadir    = /usr/local/mysql/var3
283           language   = /usr/local/share/mysql/swedish
284           user       = monty
285           [mysqld4]
286           socket     = /tmp/mysql.sock4
287           port       = 3309
288           pid-file   = /usr/local/mysql/var4/hostname.pid4
289           datadir    = /usr/local/mysql/var4
290           language   = /usr/local/share/mysql/estonia
291           user       = tonu
292           [mysqld6]
293           socket     = /tmp/mysql.sock6
294           port       = 3311
295           pid-file   = /usr/local/mysql/var6/hostname.pid6
296           datadir    = /usr/local/mysql/var6
297           language   = /usr/local/share/mysql/japanese
298           user       = jani
299
300       See Section 4.2.3.3, “Using Option Files”.
301
303       Copyright © 1997, 2013, Oracle and/or its affiliates. All rights
304       reserved.
305
306       This documentation is free software; you can redistribute it and/or
307       modify it only under the terms of the GNU General Public License as
308       published by the Free Software Foundation; version 2 of the License.
309
310       This documentation is distributed in the hope that it will be useful,
311       but WITHOUT ANY WARRANTY; without even the implied warranty of
312       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
313       General Public License for more details.
314
315       You should have received a copy of the GNU General Public License along
316       with the program; if not, write to the Free Software Foundation, Inc.,
317       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
318       http://www.gnu.org/licenses/.
319
320

SEE ALSO

322       For more information, please refer to the MySQL Reference Manual, which
323       may already be installed locally and which is also available online at
324       http://dev.mysql.com/doc/.
325

AUTHOR

327       Oracle Corporation (http://dev.mysql.com/).
328
329
330
331MySQL 5.1                         11/04/2013                   MYSQLD_MULTI(1)
Impressum