[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mysqld_safe
, The Wrapper Around mysqld
mysqld_safe
is the recommended way to start a mysqld
server on Unix. mysqld_safe
adds some safety features such as
restarting the server when an error occurs and logging run-time
information to a log file.
Note:
Before MySQL 4.0, mysqld_safe
is named safe_mysqld
.
To preserve backward compatibility, MySQL binary distributions for
some time will include safe_mysqld
as a symbolic link to
mysqld_safe
.
If you don't use --mysqld=#
or --mysqld-version=#
mysqld_safe
will use an executable named mysqld-max
if it
exists. If not, mysqld_safe
will start mysqld
.
On Linux, the MySQL-Max
RPM uses this mysqld_safe
feature. (It just installs the mysqld-max
executable, so
mysqld_safe
automatically uses this executable when
mysqld_safe
is restarted.)
The preference of mysqld_safe
for mysqld-max
over
mysqld
makes it very easy to test a new mysqld
binary in an
existing installation. Just run configure
with the options you
want and then install the new mysqld
binary as mysqld-max
in the same directory where your existing mysqld
binary is located.
On the other hand, this behavior means that if you install a MySQL-Max
distribution that includes a server named mysqld-max
, then upgrade
later to a non-Max version of MySQL, mysqld_safe
will still
attempt to run the old mysqld-max
server. If you perform such an
upgrade, manually remove the old mysqld-max
server to ensure that
mysqld_safe
runs the new mysqld
server.
Normally, you should never edit the mysqld_safe
script. Instead,
put the options to mysqld_safe
in the [mysqld_safe]
section
in a `my.cnf' option file. See section 4.3.2 Using Option Files. mysqld_safe
reads all options from the [mysqld]
, [server]
and
[mysqld_safe]
sections from the option files. (For backward
compatibility, it also reads the [safe_mysqld]
sections, though you
should rename such sections to [mysqld_safe]
once you begin using
MySQL 4.0 or later.)
Note that all options specified to mysqld_safe
on the command-line
are passed to mysqld
. If you wants to use any options for
mysqld_safe
that mysqld
doesn't support, you must specify
them in the option file.
Many of the options to mysqld_safe
are the same as the options to
mysqld
. See section 5.2.1 mysqld
Command-line Options.
mysqld_safe
supports the following options:
--basedir=path
--core-file-size=#
mysqld
should be able to create. Passed
to ulimit -c
.
--datadir=path
--defaults-extra-file=path
--defaults-file=path
--err-log=path
--log-error
option, to be used before MySQL 4.0.
--log-error=path
--ledir=path
mysqld
program.
Use this option to explicitly indicate the location of the server.
--log=path
--mysqld=prog_name
ledir
directory) that you
want to start.
--mysqld-version=suffix
--mysqld=
but here you only give the suffix for the
server program name. The base name is assumed to be mysqld
.
For example, if you use --mysqld-version=max
, mysqld_safe
will start the mysqld-max
program in the ledir
directory.
If the argument to --mysqld-version
is empty, mysqld
in the ledir
directory is used.
--nice=#
nice
program to set the server's scheduling priority to the
given value. This option was added in MySQL 4.0.14.
--no-defaults
--open-files-limit=#
mysqld
should be able to open. Passed to
ulimit -n
. Note that you need to start mysqld_safe
as
root
for this to work properly!
--pid-file=path
--port=#
--socket=path
--timezone=#
TZ
) variable to the value of this parameter.
--user=#
The mysqld_safe
script is written so that it normally is able to start
a server that was installed from either a source or a binary distribution of
MySQL, even those these normally install the server in slightly different
locations.
See section 2.1.5 Installation Layouts.
mysqld_safe
expects one of the following conditions to be true:
mysqld_safe
is invoked. mysqld_safe
looks under its working
directory for `bin' and `data' directories (for binary
distributions) or for `libexec' and `var' directories (for source
distributions). This condition should be met if you execute
mysqld_safe
from your MySQL installation directory (for
example, `/usr/local/mysql' for a binary distribution).
mysqld_safe
attempts to locate them by absolute pathnames.
Typical locations are `/usr/local/libexec' and `/usr/local/var'.
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. @end itemize
Because mysqld_safe
will try 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 start mysqld_safe
from the
MySQL installation directory:
shell> cd mysql_installation_directory shell> bin/mysqld_safe & |
If mysqld_safe
fails, even when invoked from the MySQL
installation directory, you can specify the --ledir
and
--datadir
options to indicate the directories in which the server and
databases are located on your system.
In rare cases, it may be necessary to edit mysqld_safe
to get it to
start the server properly. If you do this, note that if you upgrade MySQL in
the future, your modified version of mysqld_safe
will be overwritten,
so you should make a copy of your edited version that you can reinstall.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |