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