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