This section discusses methods for starting and stopping the MySQL server.
Generally, you start the mysqld server in one of these ways:
Invoke mysqld directly. This works on any platform.
On Windows, you can set up a MySQL service that runs automatically when Windows starts. See Starting MySQL as a Windows Service.
On Unix and Unix-like systems, you can invoke mysqld_safe, which tries to determine the proper options for mysqld and then runs it with those options. See mysqld_safe — MySQL Server Startup Script.
On systems that use System V-style run directories (that is,
/etc/init.dand run-level specific directories), invoke mysql.server. This script is used primarily at system startup and shutdown. It usually is installed under the name
mysql. The mysql.server script starts the server by invoking mysqld_safe. See mysql.server — MySQL Server Startup Script.
On OS X, install a launchd daemon to enable automatic MySQL startup at system startup. The daemon starts the server by invoking mysqld_safe. For details, see Installing a MySQL Launch Daemon. A MySQL Preference Pane also provides control for starting and stopping MySQL through the System Preferences. See Installing and Using the MySQL Preference Pane.
On Solaris/OpenSolaris, use the service management framework (SMF) system to initiate and control MySQL startup. For more information, see Installing MySQL on OpenSolaris Using IPS.
The mysqld_safe and mysql.server scripts, Solaris/OpenSolaris SMF, and the OS X Startup Item (or MySQL Preference Pane) can be used to start the server manually, or automatically at system startup time. mysql.server and the Startup Item also can be used to stop the server.
The following table shows which option groups the server and startup scripts read from option files.
Table 3.1 MySQL Startup Scripts and Supported Server Option Groups
means that groups with names like
[mysqld-5.5] are read by servers
having versions 5.1.x, 5.5.x, and so
forth. This feature can be used to specify options that can be
read only by servers within a given release series.
For backward compatibility, mysql.server also
[mysql_server] group and
mysqld_safe also reads the
[safe_mysqld] group. However, you should update
your option files to use the
[mysqld_safe] groups instead.
For more information on MySQL configuration files and their structure and contents, see Using Option Files.