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

NAME

6       mysqld_safe - MySQL server startup script
7

SYNOPSIS

9       mysqld_safe options
10

DESCRIPTION

12       mysqld_safe is the recommended way to start a mysqld server on Unix and
13       NetWare.  mysqld_safe adds some safety features such as restarting the
14       server when an error occurs and logging runtime information to an error
15       log file. Descriptions of error logging and NetWare-specific behaviors
16       are given later in this section.
17
18           Note
19           In MySQL 5.1.20 (only), the default error logging behavior with
20           mysqld_safe is to write errors to syslog on systems that support
21           the logger program. This differs from the default behavior of
22           writing an error log file for other versions.
23
24           In 5.1.20, logging to syslog may fail to operate correctly in some
25           cases; if so, use --skip-syslog to use the default log file or
26           --log-error=file_name to specify a log file name explicitly.
27
28       mysqld_safe tries to start an executable named mysqld. To override the
29       default behavior and specify explicitly the name of the server you want
30       to run, specify a --mysqld or --mysqld-version option to mysqld_safe.
31       You can also use --ledir to indicate the directory where mysqld_safe
32       should look for the server.
33
34       Many of the options to mysqld_safe are the same as the options to
35       mysqld. See Section 5.1.3, “Server Command Options”.
36
37       Options unknown to mysqld_safe are passed to mysqld if they are
38       specified on the command line, but ignored if they are specified in the
39       [mysqld_safe] group of an option file. See Section 4.2.3.3, “Using
40       Option Files”.
41
42       mysqld_safe reads all options from the [mysqld], [server], and
43       [mysqld_safe] sections in option files. For example, if you specify a
44       [mysqld] section like this, mysqld_safe will find and use the
45       --log-error option:
46
47           [mysqld]
48           log-error=error.log
49
50       For backward compatibility, mysqld_safe also reads [safe_mysqld]
51       sections, although you should rename such sections to [mysqld_safe] in
52       MySQL 5.1 installations.
53
54       mysqld_safe supports the options in the following list. It also reads
55       option files and supports the options for processing them described at
56       Section 4.2.3.4, “Command-Line Options that Affect Option-File
57       Handling”.
58
59       ·   --help
60
61           Display a help message and exit.
62
63       ·   --autoclose
64
65           (NetWare only) On NetWare, mysqld_safe provides a screen presence.
66           When you unload (shut down) the mysqld_safe NLM, the screen does
67           not by default go away. Instead, it prompts for user input:
68
69               *<NLM has terminated; Press any key to close the screen>*
70
71           If you want NetWare to close the screen automatically instead, use
72           the --autoclose option to mysqld_safe.
73
74       ·   --basedir=path
75
76           The path to the MySQL installation directory.
77
78       ·   --core-file-size=size
79
80           The size of the core file that mysqld should be able to create. The
81           option value is passed to ulimit -c.
82
83       ·   --datadir=path
84
85           The path to the data directory.
86
87       ·   --defaults-extra-file=path
88
89           The name of an option file to be read in addition to the usual
90           option files. This must be the first option on the command line if
91           it is used. If the file does not exist or is otherwise
92           inaccessible, the server will exit with an error.
93
94       ·   --defaults-file=file_name
95
96           The name of an option file to be read instead of the usual option
97           files. This must be the first option on the command line if it is
98           used.
99
100       ·   --ledir=path
101
102           If mysqld_safe cannot find the server, use this option to indicate
103           the path name to the directory where the server is located.
104
105       ·   --log-error=file_name
106
107           Write the error log to the given file. See Section 5.2.2, “The
108           Error Log”.
109
110       ·   --mysqld=prog_name
111
112           The name of the server program (in the ledir directory) that you
113           want to start. This option is needed if you use the MySQL binary
114           distribution but have the data directory outside of the binary
115           distribution. If mysqld_safe cannot find the server, use the
116           --ledir option to indicate the path name to the directory where the
117           server is located.
118
119       ·   --mysqld-version=suffix
120
121           This option is similar to the --mysqld option, but you specify only
122           the suffix for the server program name. The basename is assumed to
123           be mysqld. For example, if you use --mysqld-version=debug,
124           mysqld_safe starts the mysqld-debug program in the ledir directory.
125           If the argument to --mysqld-version is empty, mysqld_safe uses
126           mysqld in the ledir directory.
127
128       ·   --nice=priority
129
130           Use the nice program to set the server's scheduling priority to the
131           given value.
132
133       ·   --no-defaults
134
135           Do not read any option files. This must be the first option on the
136           command line if it is used.
137
138       ·   --open-files-limit=count
139
140           The number of files that mysqld should be able to open. The option
141           value is passed to ulimit -n. Note that you need to start
142           mysqld_safe as root for this to work properly!
143
144       ·   --pid-file=file_name
145
146           The path name of the process ID file.
147
148       ·   --port=port_num
149
150           The port number that the server should use when listening for
151           TCP/IP connections. The port number must be 1024 or higher unless
152           the server is started by the root system user.
153
154       ·   --skip-kill-mysqld
155
156           Do not try to kill stray mysqld processes at startup. This option
157           works only on Linux.
158
159       ·   --socket=path
160
161           The Unix socket file that the server should use when listening for
162           local connections.
163
164       ·   --syslog, --skip-syslog
165
166           --syslog causes error messages to be sent to syslog on systems that
167           support the logger program.  --skip-syslog suppresses the use of
168           syslog; messages are written to an error log file. These options
169           were added in MySQL 5.1.20.
170
171           When syslog is used, the daemon.err syslog priority/facility is
172           used for all log messages.
173
174       ·   --syslog-tag=tag
175
176           For logging to syslog, messages from mysqld_safe and mysqld are
177           written with a tag of mysqld_safe and mysqld, respectively. To
178           specify a suffix for the tag, use --syslog-tag=tag, which modifies
179           the tags to be mysqld_safe-tag and mysqld-tag. This option was
180           added in MySQL 5.1.21.
181
182       ·   --timezone=timezone
183
184           Set the TZ time zone environment variable to the given option
185           value. Consult your operating system documentation for legal time
186           zone specification formats.
187
188       ·   --user={user_name|user_id}
189
190           Run the mysqld server as the user having the name user_name or the
191           numeric user ID user_id. (“User” in this context refers to a system
192           login account, not a MySQL user listed in the grant tables.)
193
194       If you execute mysqld_safe with the --defaults-file or
195       --defaults-extra-file option to name an option file, the option must be
196       the first one given on the command line or the option file will not be
197       used. For example, this command will not use the named option file:
198
199           mysql> mysqld_safe --port=port_num --defaults-file=file_name
200
201       Instead, use the following command:
202
203           mysql> mysqld_safe --defaults-file=file_name --port=port_num
204
205       The mysqld_safe script is written so that it normally can start a
206       server that was installed from either a source or a binary distribution
207       of MySQL, even though these types of distributions typically install
208       the server in slightly different locations. (See Section 2.1.5,
209       “Installation Layouts”.)  mysqld_safe expects one of the following
210       conditions to be true:
211
212       ·   The server and databases can be found relative to the working
213           directory (the directory from which mysqld_safe is invoked). For
214           binary distributions, mysqld_safe looks under its working directory
215           for bin and data directories. For source distributions, it looks
216           for libexec and var directories. This condition should be met if
217           you execute mysqld_safe from your MySQL installation directory (for
218           example, /usr/local/mysql for a binary distribution).
219
220       ·   If the server and databases cannot be found relative to the working
221           directory, mysqld_safe attempts to locate them by absolute path
222           names. Typical locations are /usr/local/libexec and /usr/local/var.
223           The actual locations are determined from the values configured into
224           the distribution at the time it was built. They should be correct
225           if MySQL is installed in the location specified at configuration
226           time.
227
228       Because mysqld_safe tries to find the server and databases relative to
229       its own working directory, you can install a binary distribution of
230       MySQL anywhere, as long as you run mysqld_safe from the MySQL
231       installation directory:
232
233           shell> cd mysql_installation_directory
234           shell> bin/mysqld_safe &
235
236       If mysqld_safe fails, even when invoked from the MySQL installation
237       directory, you can specify the --ledir and --datadir options to
238       indicate the directories in which the server and databases are located
239       on your system.
240
241       When you use mysqld_safe to start mysqld, mysqld_safe arranges for
242       error (and notice) messages from itself and from mysqld to go to the
243       same destination.
244
245       As of MySQL 5.1.20, there are several mysqld_safe options for
246       controlling the destination of these messages:
247
248       ·   --syslog: Write error messages to syslog on systems that support
249           the logger program.
250
251       ·   --skip-syslog: Do not write error messages to syslog. Messages are
252           written to the default error log file (host_name.err in the data
253           directory), or to a named file if the --log-error option is given.
254
255       ·   --log-error=file_name: Write error messages to the named error
256           file.
257
258       If none of these options is given, the default is --skip-syslog.
259
260           Note
261           In MySQL 5.1.20 only, the default is --syslog. This differs from
262           logging behavior for other versions of MySQL, for which the default
263           is to write messages to the default error log file.
264
265       If --syslog and --log-error are both given, a warning is issued and
266       --log-error takes precedence.
267
268       When mysqld_safe writes a message, notices go to the logging
269       destination (syslog or the error log file) and stdout. Errors go to the
270       logging destination and stderr.
271
272       Before MySQL 5.1.20, error logging is controlled only with the
273       --log-error option. If it is given, messages go to the named error
274       file. Otherwise, messages go to the default error file.
275
276       Normally, you should not edit the mysqld_safe script. Instead,
277       configure mysqld_safe by using command-line options or options in the
278       [mysqld_safe] section of a my.cnf option file. In rare cases, it might
279       be necessary to edit mysqld_safe to get it to start the server
280       properly. However, if you do this, your modified version of mysqld_safe
281       might be overwritten if you upgrade MySQL in the future, so you should
282       make a copy of your edited version that you can reinstall.
283
284       On NetWare, mysqld_safe is a NetWare Loadable Module (NLM) that is
285       ported from the original Unix shell script. It starts the server as
286       follows:
287
288        1. Runs a number of system and option checks.
289
290        2. Runs a check on MyISAM tables.
291
292        3. Provides a screen presence for the MySQL server.
293
294        4. Starts mysqld, monitors it, and restarts it if it terminates in
295           error.
296
297        5. Sends error messages from mysqld to the host_name.err file in the
298           data directory.
299
300        6. Sends mysqld_safe screen output to the host_name.safe file in the
301           data directory.
302
304       Copyright © 1997, 2013, Oracle and/or its affiliates. All rights
305       reserved.
306
307       This documentation is free software; you can redistribute it and/or
308       modify it only under the terms of the GNU General Public License as
309       published by the Free Software Foundation; version 2 of the License.
310
311       This documentation is distributed in the hope that it will be useful,
312       but WITHOUT ANY WARRANTY; without even the implied warranty of
313       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
314       General Public License for more details.
315
316       You should have received a copy of the GNU General Public License along
317       with the program; if not, write to the Free Software Foundation, Inc.,
318       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
319       http://www.gnu.org/licenses/.
320
321

SEE ALSO

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

AUTHOR

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