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

SEE ALSO

308       For more information, please refer to the MySQL Reference Manual, which
309       may already be installed locally and which is also available online at
310       http://dev.mysql.com/doc/.
311

AUTHOR

313       Sun Microsystems, Inc. (http://www.mysql.com/).
314
315
316
317MySQL 5.1                         04/06/2010                    MYSQLD_SAFE(1)
Impressum