File: mysqld_safe.1

package info (click to toggle)
mysql-dfsg-5.0 5.0.51a-24%2Blenny5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 106,168 kB
  • ctags: 94,516
  • sloc: cpp: 447,179; ansic: 411,410; perl: 38,307; sh: 37,449; tcl: 30,484; pascal: 14,851; yacc: 8,559; makefile: 5,078; java: 4,610; xml: 3,953; sql: 2,920; awk: 1,338; asm: 1,061; sed: 772
file content (660 lines) | stat: -rw-r--r-- 15,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
.\"     Title: \fBmysqld_safe\fR
.\"    Author: 
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
.\"      Date: 01/11/2008
.\"    Manual: MySQL Database System
.\"    Source: MySQL 5.0
.\"
.TH "\fBMYSQLD_SAFE\fR" "1" "01/11/2008" "MySQL 5.0" "MySQL Database System"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
mysqld_safe \- MySQL server startup script
.br
safe_mysqld \- MySQL server startup script
.SH "SYNOPSIS"
.HP 20
\fBmysqld_safe \fR\fB\fIoptions\fR\fR
.SH "DESCRIPTION"
.PP
\fBmysqld_safe\fR
is the recommended way to start a
\fBmysqld\fR
server on Unix and NetWare.
\fBmysqld_safe\fR
adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file. NetWare\-specific behaviors are listed later in this section.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBNote\fR
.PP
To preserve backward compatibility with older versions of MySQL, MySQL binary distributions still include
\fBsafe_mysqld\fR
as a symbolic link to
\fBmysqld_safe\fR. However, you should not rely on this because it is removed as of MySQL 5.1.
.PP
By default,
\fBmysqld_safe\fR
before MySQL 5.0.27 tries to start an executable named
\fBmysqld\-max\fR
if it exists, and
\fBmysqld\fR
otherwise. Be aware of the implications of this behavior:
.TP 3n
\(bu
On Linux, the
MySQL\-Max
RPM relies on this
\fBmysqld_safe\fR
behavior. The RPM installs an executable named
\fBmysqld\-max\fR, which causes
\fBmysqld_safe\fR
to automatically use that executable rather than
\fBmysqld\fR
from that point on.
.TP 3n
\(bu
If you install a MySQL\-Max distribution that includes a server named
\fBmysqld\-max\fR, and then upgrade later to a non\-Max version of MySQL,
\fBmysqld_safe\fR
will still attempt to run the old
\fBmysqld\-max\fR
server. If you perform such an upgrade, you should manually remove the old
\fBmysqld\-max\fR
server to ensure that
\fBmysqld_safe\fR
runs the new
\fBmysqld\fR
server.
.sp
.RE
.PP
To override the default behavior and specify explicitly the name of the server you want to run, specify a
\fB\-\-mysqld\fR
or
\fB\-\-mysqld\-version\fR
option to
\fBmysqld_safe\fR. You can also use
\fB\-\-ledir\fR
to indicate the directory where
\fBmysqld_safe\fR
should look for the server.
.PP
Many of the options to
\fBmysqld_safe\fR
are the same as the options to
\fBmysqld\fR. See
Section\ 1.2, \(lqCommand Options\(rq.
.PP
All options specified to
\fBmysqld_safe\fR
on the command line are passed to
\fBmysqld\fR. If you want to use any options that are specific to
\fBmysqld_safe\fR
and that
\fBmysqld\fR
doesn't support, do not specify them on the command line. Instead, list them in the
[mysqld_safe]
group of an option file. See
Section\ 2.2.2, \(lqUsing Option Files\(rq.
.PP
\fBmysqld_safe\fR
reads all options from the
[mysqld],
[server], and
[mysqld_safe]
sections in option files. For example, if you specify a
[mysqld]
section like this,
\fBmysqld_safe\fR
will find and use the
\fB\-\-log\-error\fR
option:
.sp
.RS 3n
.nf
[mysqld]
log\-error=error.log
.fi
.RE
.PP
For backward compatibility,
\fBmysqld_safe\fR
also reads
[safe_mysqld]
sections, although you should rename such sections to
[mysqld_safe]
in MySQL 5.0 installations.
.PP
\fBmysqld_safe\fR
supports the following options:
.PP
.B Table\ 4.1.\ \fBmysqld_safe\fR Option Reference
.sp -1n
.TS
allbox tab(:);
lB lB lB lB.
T{
\fBFormat\fR
T}:T{
\fBConfig File\fR
T}:T{
\fBDescription\fR
T}:T{
\fBIntroduced\fR
T}
.T&
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l
l l l l.
T{
\-\-autoclose
T}:T{
autoclose
T}:T{
On NetWare, mysqld_safe provides a screen presence
T}:T{
\ 
T}
T{
\-\-mysqld=prog_name
T}:T{
mysqld
T}:T{
The name of the server program (in the ledir directory) that you  want to start
T}:T{
\ 
T}
T{
\-\-mysqld\-version=suffix
T}:T{
mysqld\-version
T}:T{
This option is similar to the \-\-mysqld option, but you specify  only the suffix for the server program name
T}:T{
\ 
T}
T{
\-\-nice=priority
T}:T{
nice
T}:T{
Use the nice program to set the server's scheduling priority to  the given value
T}:T{
\ 
T}
T{
\-\-no\-defaults
T}:T{
no\-defaults
T}:T{
Do not read any option files
T}:T{
\ 
T}
T{
\-\-open\-files\-limit=count
T}:T{
open\-files\-limit
T}:T{
The number of files that mysqld should be able to open
T}:T{
\ 
T}
T{
\-\-pid\-file
T}:T{
pid\-file
T}:T{
The pathname of the process ID file
T}:T{
\ 
T}
T{
\-\-port=number
T}:T{
port
T}:T{
The port number that the server should use when listening for  TCP/IP connections
T}:T{
\ 
T}
T{
\-\-skip\-kill\-mysqld
T}:T{
skip\-kill\-mysqld
T}:T{
Do not try to kill stray mysqld processes
T}:T{
\ 
T}
T{
\-\-socket=path
T}:T{
socket
T}:T{
The Unix socket file that the server should use when listening for  local connections
T}:T{
\ 
T}
T{
\-\-timezone=timezone
T}:T{
timezone
T}:T{
Set the TZ time zone environment variable to the given option  value
T}:T{
\ 
T}
T{
\-\-basedir=path
T}:T{
basedir
T}:T{
The path to the MySQL installation directory
T}:T{
\ 
T}
T{
\-\-user={user_name|user_id}
T}:T{
user
T}:T{
Run the mysqld server as the user having the name user_name or the  numeric user ID user_id
T}:T{
\ 
T}
T{
\-\-core\-file\-size=size
T}:T{
core\-file\-size
T}:T{
The size of the core file that mysqld should be able to create
T}:T{
\ 
T}
T{
\-\-datadir=path
T}:T{
datadir
T}:T{
The path to the data directory
T}:T{
\ 
T}
T{
\-\-defaults\-extra\-file=path
T}:T{
defaults\-extra\-file
T}:T{
The name of an option file to be read in addition to the usual  option files
T}:T{
\ 
T}
T{
\-\-defaults\-file=file_name
T}:T{
defaults\-file
T}:T{
The name of an option file to be read instead of the usual option  files
T}:T{
\ 
T}
T{
\-\-help
T}:T{
\ 
T}:T{
Display a help message and exit
T}:T{
5.0.3
T}
T{
\-\-ledir=path
T}:T{
ledir
T}:T{
Use this option to indicate the pathname to the directory where  the server is located
T}:T{
\ 
T}
T{
\-\-log\-error=file_name
T}:T{
log\-error
T}:T{
Write the error log to the given file
T}:T{
\ 
T}
.TE
.sp
.TP 3n
\(bu
\fB\-\-help\fR
.sp
Display a help message and exit. (Added in MySQL 5.0.3)
.TP 3n
\(bu
\fB\-\-autoclose\fR
.sp
(NetWare only) On NetWare,
\fBmysqld_safe\fR
provides a screen presence. When you unload (shut down) the
\fBmysqld_safe\fR
NLM, the screen does not by default go away. Instead, it prompts for user input:
.sp
.RS 3n
.nf
*<NLM has terminated; Press any key to close the screen>*
.fi
.RE
If you want NetWare to close the screen automatically instead, use the
\fB\-\-autoclose\fR
option to
\fBmysqld_safe\fR.
.TP 3n
\(bu
\fB\-\-basedir=\fR\fB\fIpath\fR\fR
.sp
The path to the MySQL installation directory.
.TP 3n
\(bu
\fB\-\-core\-file\-size=\fR\fB\fIsize\fR\fR
.sp
The size of the core file that
\fBmysqld\fR
should be able to create. The option value is passed to
\fBulimit \-c\fR.
.TP 3n
\(bu
\fB\-\-datadir=\fR\fB\fIpath\fR\fR
.sp
The path to the data directory.
.TP 3n
\(bu
\fB\-\-defaults\-extra\-file=\fR\fB\fIpath\fR\fR
.sp
The name of an option file to be read in addition to the usual option files. This must be the first option on the command line if it is used. As of MySQL 5.0.6, if the file does not exist or is otherwise inaccessible, the server will exit with an error.
.TP 3n
\(bu
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
.sp
The name of an option file to be read instead of the usual option files. This must be the first option on the command line if it is used.
.TP 3n
\(bu
\fB\-\-ledir=\fR\fB\fIpath\fR\fR
.sp
If
\fBmysqld_safe\fR
cannot find the server, use this option to indicate the pathname to the directory where the server is located.
.TP 3n
\(bu
\fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR
.sp
Write the error log to the given file. See
Section\ 2.1, \(lqThe Error Log\(rq.
.TP 3n
\(bu
\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR
.sp
The name of the server program (in the
ledir
directory) that you want to start. This option is needed if you use the MySQL binary distribution but have the data directory outside of the binary distribution. If
\fBmysqld_safe\fR
cannot find the server, use the
\fB\-\-ledir\fR
option to indicate the pathname to the directory where the server is located.
.TP 3n
\(bu
\fB\-\-mysqld\-version=\fR\fB\fIsuffix\fR\fR
.sp
This option is similar to the
\fB\-\-mysqld\fR
option, but you specify only the suffix for the server program name. The basename is assumed to be
\fBmysqld\fR. For example, if you use
\fB\-\-mysqld\-version=debug\fR,
\fBmysqld_safe\fR
starts the
\fBmysqld\-debug\fR
program in the
ledir
directory. If the argument to
\fB\-\-mysqld\-version\fR
is empty,
\fBmysqld_safe\fR
uses
\fBmysqld\fR
in the
ledir
directory.
.TP 3n
\(bu
\fB\-\-nice=\fR\fB\fIpriority\fR\fR
.sp
Use the
nice
program to set the server's scheduling priority to the given value.
.TP 3n
\(bu
\fB\-\-no\-defaults\fR
.sp
Do not read any option files. This must be the first option on the command line if it is used.
.TP 3n
\(bu
\fB\-\-open\-files\-limit=\fR\fB\fIcount\fR\fR
.sp
The number of files that
\fBmysqld\fR
should be able to open. The option value is passed to
\fBulimit \-n\fR. Note that you need to start
\fBmysqld_safe\fR
as
root
for this to work properly!
.TP 3n
\(bu
\fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR
.sp
The pathname of the process ID file.
.TP 3n
\(bu
\fB\-\-port=\fR\fB\fIport_num\fR\fR
.sp
The port number that the server should use when listening for TCP/IP connections. The port number must be 1024 or higher unless the server is started by the
root
system user.
.TP 3n
\(bu
\fB\-\-skip\-kill\-mysqld\fR
.sp
Do not try to kill stray
\fBmysqld\fR
processes at startup. This option works only on Linux.
.TP 3n
\(bu
\fB\-\-socket=\fR\fB\fIpath\fR\fR
.sp
The Unix socket file that the server should use when listening for local connections.
.TP 3n
\(bu
\fB\-\-timezone=\fR\fB\fItimezone\fR\fR
.sp
Set the
TZ
time zone environment variable to the given option value. Consult your operating system documentation for legal time zone specification formats.
.TP 3n
\(bu
\fB\-\-user={\fR\fB\fIuser_name\fR\fR\fB|\fR\fB\fIuser_id\fR\fR\fB}\fR
.sp
Run the
\fBmysqld\fR
server as the user having the name
\fIuser_name\fR
or the numeric user ID
\fIuser_id\fR. (\(lqUser\(rq
in this context refers to a system login account, not a MySQL user listed in the grant tables.)
.sp
.RE
.PP
If you execute
\fBmysqld_safe\fR
with the
\fB\-\-defaults\-file\fR
or
\fB\-\-defaults\-extra\-option\fR
option to name an option file, the option must be the first one given on the command line or the option file will not be used. For example, this command will not use the named option file:
.sp
.RS 3n
.nf
mysql> \fBmysqld_safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
.fi
.RE
.PP
Instead, use the following command:
.sp
.RS 3n
.nf
mysql> \fBmysqld_safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR
.fi
.RE
.PP
The
\fBmysqld_safe\fR
script is written so that it normally can start a server that was installed from either a source or a binary distribution of MySQL, even though these types of distributions typically install the server in slightly different locations. (See
Section\ 4.6, \(lqInstallation Layouts\(rq.)
\fBmysqld_safe\fR
expects one of the following conditions to be true:
.TP 3n
\(bu
The server and databases can be found relative to the working directory (the directory from which
\fBmysqld_safe\fR
is invoked). For binary distributions,
\fBmysqld_safe\fR
looks under its working directory for
\fIbin\fR
and
\fIdata\fR
directories. For source distributions, it looks for
\fIlibexec\fR
and
\fIvar\fR
directories. This condition should be met if you execute
\fBmysqld_safe\fR
from your MySQL installation directory (for example,
\fI/usr/local/mysql\fR
for a binary distribution).
.TP 3n
\(bu
If the server and databases cannot be found relative to the working directory,
\fBmysqld_safe\fR
attempts to locate them by absolute pathnames. Typical locations are
\fI/usr/local/libexec\fR
and
\fI/usr/local/var\fR. The actual locations are determined from the values configured into the distribution at the time it was built. They should be correct if MySQL is installed in the location specified at configuration time.
.sp
.RE
.PP
Because
\fBmysqld_safe\fR
tries to find the server and databases relative to its own working directory, you can install a binary distribution of MySQL anywhere, as long as you run
\fBmysqld_safe\fR
from the MySQL installation directory:
.sp
.RS 3n
.nf
shell> \fBcd \fR\fB\fImysql_installation_directory\fR\fR
shell> \fBbin/mysqld_safe &\fR
.fi
.RE
.PP
If
\fBmysqld_safe\fR
fails, even when invoked from the MySQL installation directory, you can specify the
\fB\-\-ledir\fR
and
\fB\-\-datadir\fR
options to indicate the directories in which the server and databases are located on your system.
.PP
Normally, you should not edit the
\fBmysqld_safe\fR
script. Instead, configure
\fBmysqld_safe\fR
by using command\-line options or options in the
[mysqld_safe]
section of a
\fImy.cnf\fR
option file. In rare cases, it might be necessary to edit
\fBmysqld_safe\fR
to get it to start the server properly. However, if you do this, your modified version of
\fBmysqld_safe\fR
might be overwritten if you upgrade MySQL in the future, so you should make a copy of your edited version that you can reinstall.
.PP
On NetWare,
\fBmysqld_safe\fR
is a NetWare Loadable Module (NLM) that is ported from the original Unix shell script. It starts the server as follows:
.TP 3n
1.
Runs a number of system and option checks.
.TP 3n
2.
Runs a check on
MyISAM
tables.
.TP 3n
3.
Provides a screen presence for the MySQL server.
.TP 3n
4.
Starts
\fBmysqld\fR, monitors it, and restarts it if it terminates in error.
.TP 3n
5.
Sends error messages from
\fBmysqld\fR
to the
\fI\fIhost_name\fR\fR\fI.err\fR
file in the data directory.
.TP 3n
6.
Sends
\fBmysqld_safe\fR
screen output to the
\fI\fIhost_name\fR\fR\fI.safe\fR
file in the data directory.
.SH "COPYRIGHT"
.PP
Copyright 2007\-2008 MySQL AB
.PP
This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/.
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
MySQL AB (http://www.mysql.com/).