mysqld_safe is a shell script that starts the mysqld server and monitors it. If the server dies, mysqld_safe restarts it. If there is a server named mysqld-max, mysqld_safe starts it rather than mysqld.
mysqld_safe is a shell script and is unavailable on Windows. There is also a compiled version that can be used on NetWare.
Prior to MySQL 4, mysqld_safe was known as safe_mysqld. See "Upgrading Tips" later in this section.
Options Specific to mysqld_safe
Options that may be used with mysqld may also be used with mysqld_safe, which simply passes them to mysqld. In addition, mysqld_safe understands the following options of its own:
The pathname to the MySQL base directory.
Limit the size of core files to n bytes if the server crashes.
The pathname to the MySQL data directory.
This is the old form of the --log-error option.
Look for the server in this directory. (It's taken to be the location of the "libexec" directory.)
Use this file for the error log. Relative names are interpreted with respect to the directory from which mysqld_safe was invoked. If this option is not specified, the default error log is HOSTNAME.err in the data directory, where HOSTNAME is the name of the current host.
Use file_name as the path to the mysqld program.
The value of this option is a suffix string. If the option is given, the suffix is added to the basename mysqld, with a dash in between, to produce the name of the server that mysqld_safe should start.
Set to n the number of file descriptors that should be made available to mysqld.
Set the name of the mysqld process ID file.
The port number on which the server should listen for TCP/IP connections.
Do not try to kill any currently running mysqld process before starting a new one. This can be useful if you are running multiple instances of a given mysqld binary. If is effective only on Linux.
The pathname of the Unix socket file.
Set the time zone to tz_name. This might be useful if the server doesn't determine the system time zone automatically.
The username or numeric user ID of the account to use for running the server.
If you're upgrading to MySQL 4.x from MySQL 3.x, when mysqld_safe was known as safe_mysqld, watch out for the following issues:
You should modify any startup scripts that invoke safe_mysqld so that they invoke mysqld_safe instead. The mysql.server script is one example. However, if you replace your older version with a 4.x version, that will update it automatically to invoke mysqld_safe. If you're using your own startup scripts, make the necessary adjustments.
You should rename [safe_mysqld] groups in option files to [mysqld_safe].