The MySQL Installation Package includes a startup item that can be used to automatically start and stop MySQL.
Startup items are deprecated in favor of launchd daemons. For additional information, see Chapter 3, Installing a MySQL Launch Daemon.
To install the MySQL Startup Item:
Download and open the MySQL package installer, which is
provided on a disk image (
includes the main MySQL installation package.
Previously, the OS X packages included separate
MySQL.prefPane files. They have since
been merged into the main package file.
Go through the process of installing the MySQL server as described in the documentation at Chapter 2, Installing MySQL on OS X Using Native Packages.
Click Customize at the Installation Type step. The "Startup Item" option is listed there and enabled by default.
Complete the MySQL server installation process.
The Startup Item for MySQL is installed into
/Library/StartupItems/MySQLCOM. The Startup
Item installation adds a variable
MYSQLCOM=-YES- to the system configuration file
/etc/hostconfig. If you want to disable the
automatic startup of MySQL, change this variable to
Deselecting Automatically Start MySQL Server on
Startup from the
Pane sets the
MYSQLCOM variable to
After the installation, you can start and stop the MySQL server from the MySQL Preference Pane (preferred), or by running the following commands in a terminal window. You must have administrator privileges to perform these tasks, and you may be prompted for your password.
If you have installed the Startup Item, use this command to start the server:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
If you have installed the Startup Item, use this command to stop the server:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop