.\" ** You probably do not want to edit this file directly ** .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "\\FBMYSQLD_SAFE\\FR" "1" "07/19/2006" "MySQL 4.1" "MySQL Database System" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" mysqld_safe \- MySQL server startup script 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. .PP \fBNote\fR: Before MySQL 4.0, \fBmysqld_safe\fR is named \fBsafe_mysqld\fR. To preserve backward compatibility, MySQL binary distributions include \fBsafe_mysqld\fR as a symbolic link to \fBmysqld_safe\fR until MySQL 5.1. .PP By default, \fBmysqld_safe\fR 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 3 \(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 \(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. .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 the section called \(lq\\FBMYSQLD\\FR COMMAND 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 does not support, do not specify them on the command line. Instead, list them in the [mysqld_safe] group of an option file. See Section\ 3.2, \(lqUsing Option Files\(rq. .PP \fBmysqld_safe\fR reads all options from the [mysqld], [server], and [mysqld_safe] sections in option files. For backward compatibility, it also reads [safe_mysqld] sections, although you should rename such sections to [mysqld_safe] when you begin using MySQL 4.0 or later. .PP \fBmysqld_safe\fR supports the following options: .TP 3 \(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 .nf ** .fi If you want NetWare to close the screen automatically instead, use the \fB\-\-autoclose\fR option to \fBmysqld_safe\fR. .TP \(bu \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp The path to the MySQL installation directory. .TP \(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 \(bu \fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp The path to the data directory. .TP \(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. .TP \(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 \(bu \fB\-\-err\-log=\fR\fB\fIfile_name\fR\fR .sp The old form of the \fB\-\-log\-error\fR option, to be used before MySQL 4.0. .TP \(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 \(bu \fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR .sp Write the error log to the given file. See Section\ 10.1, \(lqThe Error Log\(rq. .TP \(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 \(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=max\fR, \fBmysqld_safe\fR starts the \fBmysqld\-max\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 \(bu \fB\-\-nice=\fR\fB\fIpriority\fR\fR .sp Use the nice program to set the server's scheduling priority to the given value. This option was added in MySQL 4.0.14. .TP \(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 \(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 \(bu \fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR .sp The pathname of the process ID file. .TP \(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 \(bu \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp The Unix socket file that the server should use when listening for local connections. .TP \(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 \(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.) .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 .nf mysql> \fBmysqld_safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .fi .PP Instead, use the following command: .sp .nf mysql> \fBmysqld_safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR .fi .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\ 1.5, \(lqInstallation Layouts\(rq.) \fBmysqld_safe\fR expects one of the following conditions to be true: .TP 3 \(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 \(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. .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 .nf shell> \fBcd \fR\fB\fImysql_installation_directory\fR\fR shell> \fBbin/mysqld_safe &\fR .fi .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 3 1. Runs a number of system and option checks. .TP 2. Runs a check on MyISAM and ISAM tables. .TP 3. Provides a screen presence for the MySQL server. .TP 4. Starts \fBmysqld\fR, monitors it, and restarts it if it terminates in error. .TP 5. Sends error messages from \fBmysqld\fR to the \fI\fIhost_name\fR\fR\fI.err\fR file in the data directory. .TP 6. Sends \fBmysqld_safe\fR screen output to the \fI\fIhost_name\fR\fR\fI.safe\fR file in the data directory. .SH "SEE ALSO" isamchk(1), isamlog(1), msql2mysql(1), myisam_ftdump(1), myisamchk(1), myisamlog(1), myisampack(1), mysql(1), mysql.server(1), mysql_config(1), mysql_explain_log(1), mysql_fix_privilege_tables(1), mysql_zap(1), mysqlaccess(1), mysqladmin(1), mysqlbinlog(1), mysqlcheck(1), mysqld(1), mysqld_multi(1), mysqldump(1), mysqlhotcopy(1), mysqlimport(1), mysqlshow(1), pack_isam(1), perror(1), replace(1), safe_mysqld(1) .P 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/). This software comes with no warranty.