safe_mysqld, the wrapper around mysqld
--------------------------------------
`safe_mysqld' is the recommended way to start a `mysqld' daemon on
Unix. `safe_mysqld' adds some safety features such as restarting the
server when an error occurs and logging run-time information to a log
file.
If you don't use `--mysqld=#' or `--mysqld-version=#' `safe_mysqld'
will use an executable named `mysqld-max' if it exists. If not,
`safe_mysqld' will start `mysqld'. This makes it very easy to test to
use `mysqld-max' instead of `mysqld'; Just copy `mysqld-max' to where
you have `mysqld' and it will be used.
Normally one should never edit the `safe_mysqld' script, but instead
put the options to `safe_mysqld' in the `[safe_mysqld]' section in the
`my.cnf' file. `safe_mysqld' will read all options from the `[mysqld]',
`[server]' and `[safe_mysqld]' sections from the option files. Note:Option files.
Note that all options on the command line to `safe_mysqld' are passed
to `mysqld'. If you wants to use any options in `safe_mysqld' that
`mysqld' doesn't support, you must specify these in the option file.
Most of the options to `safe_mysqld' are the same as the options to
`mysqld'. Note:Command-line options.
`safe_mysqld' supports the following options:
`--basedir=path'
`--core-file-size=#'
Size of the core file `mysqld' should be able to create. Passed to
`ulimit -c'.
`--datadir=path'
`--defaults-extra-file=path'
`--defaults-file=path'
`--err-log=path'
`--ledir=path'
Path to `mysqld'
`--log=path'
`--mysqld=mysqld-version'
Name of the `mysqld' version in the `ledir' directory you want to
start.
`--mysqld-version=version'
Similar to `--mysqld=' but here you only give the suffix for
`mysqld'. For example if you use `--mysqld-version=max',
`safe_mysqld' will start the `ledir/mysqld-max' version. If the
argument to `--mysqld-version' is empty, `ledir/mysqld' will be
used.
`--no-defaults'
`--open-files-limit=#'
Number of files `mysqld' should be able to open. Passed to `ulimit
-n'. Note that you need to start `safe_mysqld' as root for this to
work properly!
`--pid-file=path'
`--port=#'
`--socket=path'
`--timezone=#'
Set the timezone (the `TZ') variable to the value of this
parameter.
`--user=#'
The `safe_mysqld' script is written so that it normally is able to start
a server that was installed from either a source or a binary version of
MySQL, even if these install the server in slightly different
locations. `safe_mysqld' expects one of these conditions to be true:
* The server and databases can be found relative to the directory
from which `safe_mysqld' is invoked. `safe_mysqld' 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
`safe_mysqld' from your MySQL installation directory (for example,
`/usr/local/mysql' for a binary distribution).
* If the server and databases cannot be found relative to the
working directory, `safe_mysqld' attempts to locate them by
absolute pathnames. Typical locations are `/usr/local/libexec'
and `/usr/local/var'. The actual locations are determined when
the distribution was built from which `safe_mysqld' comes. They
should be correct if MySQL was installed in a standard location.
Because `safe_mysqld' 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 `safe_mysqld' from the MySQL
installation directory:
shell> cd mysql_installation_directory
shell> bin/safe_mysqld &
If `safe_mysqld' fails, even when invoked from the MySQL installation
directory, you can modify it to use the path to `mysqld' and the
pathname options that are correct for your system. Note that if you
upgrade MySQL in the future, your modified version of `safe_mysqld'
will be overwritten, so you should make a copy of your edited version
that you can reinstall.