On Unix and Unix-like systems such as Linux (but not on Mac OS X), there are a couple of different ways of starting and stopping MySQL depending on whether you are dealing with a SVR4 or another flavor of Unix. The mysql.server script exists for SVR4 systems, and safe_mysqld works for any other Unix system.[3] We describe general “rules of thumb” for using these scripts. One of the maddening things about Unix systems, however, is in how they differ slightly from system to system in the details of service startup and shutdown.


The mysql.server script supports the startup and shutdown of MySQL on SVR4 systems.[4] You can find this script in the support-files directory of your installation, usually /usr/local/mysql/support-files. The SVR4 startup/shutdown mechanism relies on a set of scripts in the /etc folder to start and stop services when the system enters different run levels.


If you installed MySQL on Linux using the RPM packages, mysql.server was probably installed on your system. The RPM installer renames mysql.server to mysql when it copies the file to /etc/rc.d/init.d. If the file /etc/rc.d/init.d/mysql exists, you are already set up to have MySQL automatically start up and shut down.

The procedure for installing mysql.server on a RedHat Linux system is:

$ cp mysql.server /etc/rc.d/init.d
$ ln -s /etc/rc.d/init.d/mysql.server /etc/rc.d/rc3.d/S99mysql
$ ln -s /etc/rc.d/init.d/mysql.server /etc/rc.d/rc0.d/S01mysql

The first line installs the script into ...

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.