4.1. mysqld — The MySQL Server
mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files.
When MySQL server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients.
The mysqld program has many options that can be specified at startup. For a complete list of options, run this command:
shell> mysqld –verbose –help
Command to start mysql
shell> mysqld –user=mysql // (–console)
MySQL Server also has a set of system variables that affect its operation as it runs. System variables can be set at server startup, and many of them can be changed at runtime to effect dynamic server reconfiguration. MySQL Server also has a set of status variables that provide information about its operation. You can monitor these status variables to access runtime performance characteristics.
4.2. mysqld_safe — MySQL Server Startup Script
mysqld_safe is the recommended way to start a mysqld server on Unix and NetWare. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file.
mysqld_safe reads all options from the [mysqld], [server], and [mysqld_safe] sections in option files.
The mysqld_safe 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 2.7, “Installation Layouts”.) mysqld_safe expects one of the following conditions to be true:
The server and databases can be found relative to the working directory (the directory from which mysqld_safe is invoked). For binary distributions, mysqld_safe looks under its working directory for bin and data directories. For source distributions, it looks for libexec and var directories. This condition should be met if you execute mysqld_safe 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, mysqld_safe attempts to locate them by absolute path names. 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.
The path to the MySQL installation directory.
Display a help message and exit
The name of an option file to be read in addition to the usual option files.
Write the error log to the given file
If mysqld_safe cannot find the server, use this option to indicate the path name to the directory where the server is located
Do not read any option files. This must be the first option on the command line if it is used.
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.
This option is similar to the –mysqld option, but you specify only the suffix for the server program name. The basename is assumed to be mysqld. For example, if you use –mysqld- version=debug, mysqld_safe starts the mysqld-debug program in the ledir directory. If the argument to –mysqld-version is empty,mysqld_safe uses mysqld in the ledir directory.
The number of files that mysqld should be able to open. The option value is passed to ulimit -n. Note that you need to start mysqld_safe as root for this to work properly!
The path name of the process ID file.
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.
The Unix socket file that the server should use when listening for local connections.
4.3. mysql.server — MySQL Server Startup Script
MySQL distributions on Unix include a script named mysql.server . It can be used on systems such as Linux and Solaris that use System V-style run directories to start and stop system services. It is also used by the Mac OS X Startup Item for MySQL. mysql.server can be found in the support-files directory under your MySQL installation directory or in a MySQL source distribution.
The path to the MySQL installation directory.
The path to the MySQL data directory.
The path name of the file in which the server should write its process ID.
How long in seconds to wait for confirmation of server startup. If the server does not start within this time, mysql.server exits with an error. The default value is 900. A value of 0 means not to wait at all for startup. Negative values mean to wait forever (no timeout). This option was added in MySQL 5.1.17. Before that, a value of 900 is always used.
Use mysqld_safe to start the server. This is the default.
The login user name to use for running mysqld.
4.4. mysqld_multi ― Manage Multiple MySQL Servers