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, --nowatch, --no-watch
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 • --numa-interleave
130
131 Run mysqld with its memory interleaved on all NUMA nodes.
132
133 • --open-files-limit=count
134
135 The number of files that mysqld should be able to open. The option
136 value is passed to ulimit -n. Note that you need to start
137 mysqld_safe as root for this to work properly!
138
139 • --pid-file=file_name
140
141 The path name of the process ID file.
142
143 • --plugin-dir=dir_name
144
145 Directory for client-side plugins.
146
147 • --port=port_num
148
149 The port number that the server should use when listening for
150 TCP/IP connections. The port number must be 1024 or higher unless
151 the server is started by the root system user.
152
153 • --skip-kill-mysqld
154
155 Do not try to kill stray mysqld processes at startup. This option
156 works only on Linux.
157
158 • --socket=path
159
160 The Unix socket file that the server should use when listening for
161 local connections.
162
163 • --syslog, --skip-syslog
164
165 --syslog causes error messages to be sent to syslog on systems that
166 support the logger program. --skip-syslog suppresses the use of
167 syslog; messages are written to an error log file.
168
169 • --syslog-tag=tag
170
171 For logging to syslog, messages from mysqld_safe and mysqld are
172 written with a tag of mysqld_safe and mysqld, respectively. To
173 specify a suffix for the tag, use --syslog-tag=tag, which modifies
174 the tags to be mysqld_safe-tag and mysqld-tag.
175
176 • --timezone=timezone
177
178 Set the TZ time zone environment variable to the given option
179 value. Consult your operating system documentation for legal time
180 zone specification formats.
181
182 • --user={user_name|user_id}
183
184 Run the mysqld server as the user having the name user_name or the
185 numeric user ID user_id. (“User” in this context refers to a system
186 login account, not a MariaDB user listed in the grant tables.)
187
188 If you execute mysqld_safe with the --defaults-file or
189 --defaults-extra-file option to name an option file, the option must be
190 the first one given on the command line or the option file will not be
191 used. For example, this command will not use the named option file:
192
193 mysql> mysqld_safe --port=port_num --defaults-file=file_name
194
195 Instead, use the following command:
196
197 mysql> mysqld_safe --defaults-file=file_name --port=port_num
198
199 The mysqld_safe script is written so that it normally can start a
200 server that was installed from either a source or a binary distribution
201 of MariaDB, even though these types of distributions typically install
202 the server in slightly different locations. mysqld_safe expects one of
203 the following conditions to be true:
204
205 • The server and databases can be found relative to the working
206 directory (the directory from which mysqld_safe is invoked). For
207 binary distributions, mysqld_safe looks under its working directory
208 for bin and data directories. For source distributions, it looks
209 for libexec and var directories. This condition should be met if
210 you execute mysqld_safe from your MariaDB installation directory
211 (for example, /usr/local/mysql for a binary distribution).
212
213 • If the server and databases cannot be found relative to the working
214 directory, mysqld_safe attempts to locate them by absolute path
215 names. Typical locations are /usr/local/libexec and /usr/local/var.
216 The actual locations are determined from the values configured into
217 the distribution at the time it was built. They should be correct
218 if MariaDB is installed in the location specified at configuration
219 time.
220
221 Because mysqld_safe tries to find the server and databases relative to
222 its own working directory, you can install a binary distribution of
223 MariaDB anywhere, as long as you run mysqld_safe from the MariaDB
224 installation directory:
225
226 shell> cd mysql_installation_directory
227 shell> bin/mysqld_safe &
228
229 If mysqld_safe fails, even when invoked from the MariaDB installation
230 directory, you can specify the --ledir and --datadir options to
231 indicate the directories in which the server and databases are located
232 on your system.
233
234 When you use mysqld_safe to start mysqld, mysqld_safe arranges for
235 error (and notice) messages from itself and from mysqld to go to the
236 same destination.
237
238 There are several mysqld_safe options for controlling the destination
239 of these messages:
240
241 • --syslog: Write error messages to syslog on systems that support
242 the logger program.
243
244 • --skip-syslog: Do not write error messages to syslog. Messages are
245 written to the default error log file (host_name.err in the data
246 directory), or to a named file if the --log-error option is given.
247
248 • --log-error=file_name: Write error messages to the named error
249 file.
250
251 If none of these options is given, the default is --skip-syslog.
252
253 Note
254 If --syslog and --log-error are both given, a warning is issued and
255 --log-error takes precedence.
256
257 When mysqld_safe writes a message, notices go to the logging
258 destination (syslog or the error log file) and stdout. Errors go to the
259 logging destination and stderr.
260
261 Normally, you should not edit the mysqld_safe script. Instead,
262 configure mysqld_safe by using command-line options or options in the
263 [mysqld_safe] section of a my.cnf option file. In rare cases, it might
264 be necessary to edit mysqld_safe to get it to start the server
265 properly. However, if you do this, your modified version of mysqld_safe
266 might be overwritten if you upgrade MariaDB in the future, so you
267 should make a copy of your edited version that you can reinstall.
268
269 On NetWare, mysqld_safe is a NetWare Loadable Module (NLM) that is
270 ported from the original Unix shell script. It starts the server as
271 follows:
272
273 1. Runs a number of system and option checks.
274
275 2. Runs a check on MyISAM tables.
276
277 3. Provides a screen presence for the MariaDB server.
278
279 4. Starts mysqld, monitors it, and restarts it if it terminates in
280 error.
281
282 5. Sends error messages from mysqld to the host_name.err file in the
283 data directory.
284
285 6. Sends mysqld_safe screen output to the host_name.safe file in the
286 data directory.
287
289 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
290 2010-2019 MariaDB Foundation
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-1335 USA or see
304 http://www.gnu.org/licenses/.
305
306
308 For more information, please refer to the MariaDB Knowledge Base,
309 available online at https://mariadb.com/kb/
310
312 MariaDB Foundation (http://www.mariadb.org/).
313
314
315
316MariaDB 10.5 27 June 2019 MARIADBD-SAFE(1)