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

I have seen numerous suggestions about using MAMP to install MySQL on OS X, but since I have the Server app and already have Apache and PHP, which I do not wish to mess up, I wonder how to properly install MySQL.

Using the community download's DMG installer package from the MySQL website it has two flaws:

  1. The page states its latest version to be OS X 10.9
  2. Once the installer is downloaded and mounted, it displays that it is actually meant for OS X 10.8 (verified with the OS X 10.8 download, which is identical in size; they just changed the name of the DMG, which is pretty lame, but a story for itself)

Trying to install MySQL from that package nevertheless, it ran without problems. I can even manually start the MySQL server, which, according to System Preferences, is then running.

However, the next parts do not work and I wonder how to actually get them working:

  • /usr/local/mysql-5.6.25-osx10.8-x86_64/bin/ has not been added to the path, which makes running mysql a pain (sure I can manually add it, but if the installer failed to do so, something is not right from the start)
  • using System Preferences to get the MySQL Server to start on system start failed with a less than informative error message

MySQL Server Error Message

  • even Console is disappointingly sparse on information and just shows the following two lines when trying to tick the checkbox

    7/21/2015 8:18:54.748 PM System Preferences[5620]: about to perform command
    7/21/2015 8:18:54.764 PM System Preferences[5620]: status= 4

You may wonder why install MySQL when you have Postgres. Well, I want to install MediaWiki and do not want to mess around with the system accounts, like resetting passwords (it may break every other Server service which uses Postgres) and secondly, following the installation, MediaWiki prefers MySQL over Postgres (which I second as well).

Did anyone successfully install MySQL on their OS X Yosemite installation (running OS X Server)?

Best Answer


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 file in /Library/LaunchDaemons looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
    <key>Label</key>             <string></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>WorkingDirectory</key>  <string>/usr/local/mysql</string>

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.