How to Properly Install MySQL Server onto OS X 10.10 Running OS X Server

Preface:

It's no problem to install MAMP, MAMP Pro or Bitnami MAMP Stack on OS X Server (Yosemite or older). All of them are self-containing stacks and get installed to the /Applications folder. They don't interfere with any original software like Oracle MySQL/PostgreSQL/OS X Server postgres provided you don't use their distinctive ports. All the MAMP stacks are easy to configure to reserve other ports (e.g. mysql/http/https etc).

It's not advised to use the OS X Server PostgreSQL for any of your purposes. It may be unnoticed subject of change by Apple. Download and install PostgreSQL and use that one.

Installing Oracle MySQL Community Edition:

Trying to set-up and get EJBCA working on Yosemite I had to install Oracle MySQL recently and it worked flawlessly.

After downloading the installer, open the image and install MySQL with the default settings using your admin account.

The default settings meanwhile install a plist to /Library/LaunchDaemons to provide the recommended way to start-up services at boot time (with launchd). Older versions used to use the /Library/StartupItems folder.

A proper com.oracle.oss.mysql.mysqld.plist file in /Library/LaunchDaemons looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>             <string>com.oracle.oss.mysql.mysqld</string>
    <key>ProcessType</key>       <string>Interactive</string>
    <key>Disabled</key>          <false/>
    <key>RunAtLoad</key>         <true/>
    <key>KeepAlive</key>         <true/>
    <key>SessionCreate</key>     <true/>
    <key>LaunchOnlyOnce</key>    <false/>
    <key>UserName</key>          <string>_mysql</string>
    <key>GroupName</key>         <string>_mysql</string>
    <key>ExitTimeOut</key>       <integer>600</integer>
    <key>Program</key>           <string>/usr/local/mysql/bin/mysqld</string>
    <key>ProgramArguments</key>
        <array>
            <string>/usr/local/mysql/bin/mysqld</string>
            <string>--user=_mysql</string>
            <string>--basedir=/usr/local/mysql</string>
            <string>--datadir=/usr/local/mysql/data</string>
            <string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
            <string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
            <string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
            <string>--port=3307</string>
        </array>
    <key>WorkingDirectory</key>  <string>/usr/local/mysql</string>
</dict>
</plist>

Until now I never had a problem to get this running right out-of-the-box. If your MySQL doesn't start properly please check the /Library/LaunchDaemon and the /Library/StartupItems folder for older versions of the plist or conflicting start-up-items.

The only thing indeed you have to do manually, is adding the bin folder of mysql to your path.

You have the following options:

  • add it to /etc/paths to add it to all paths of your users with:

    sudo echo "/usr/local/mysql/bin" >> /etc/paths
    
  • add it to your user's path by e.g.:

    touch ~/.bash_profile
    echo "export PATH=/usr/local/mysql/bin:$PATH" >> ~/.bash_profile
    

    /usr/local/mysql/bin instead of /usr/local/mysql-5.6.25-osx10.8-x86_64/bin works even after future updates because a link called mysql is created while installation of MySQL linking to the real mysql-version-osversion-proc_bit folder.

  • use launchd (question & answer here - you may find some other methods there also)

If you prefer to use a GUI to configure, tweak and work with MySQL, download MySQL Workbench. Please consider to use port 3307 instead of 3306 connecting from your local host to localhost. You may set the root password after connecting the first time.


I found the homebrew version of mysql worked perfectly on OS X 10.10.3 and 10.10. running Server. brew install mysql and all was good - mysql.server start starts it and mysql.server stop does the reverse.