MySQL Preference Pane control for MySQL installed via Homebrew

I've had the same issue. After googling my butt off, here's what I was able to find out:

  1. install symlinks to Homebrew's MySQL installation in /usr/local/mysql:

    mkdir -p /usr/local/mysql; cd /usr/local/mysql
    ln -s $(brew --prefix mysql)/* .
    

    (this already allows you to stop the MySQL Server using the button in that preference pane – because it simply uses the mysqladmin binary – but not to start it)

  2. The preference pane attempts to start the MySQL server as user mysql or _mysql rather than running it with your user name. They say it's a good idea to have a dedicated UNIX user for the SQL server anyway... Therefore the data directory must be owned by the user called _mysql or mysql as well.

    You can find out where your data directory is by looking for the entry datadir= inside /etc/my.cnf, or $HOME/.my.cnf, or $(brew --prefix mysql)/support-files/mysql.server, then chown it accordingly.

    Alternatively, you could start with a fresh data directory using mysql_install_db:

    unset TMPDIR
    sudo mysql_install_db --user=_mysql --basedir="$(brew --prefix mysql)" --datadir=/your/data/dir
    

    Note that, after installing it like this, you won't be able to start the MySQL server with your username anymore, at least not without sudo -u.

    If there's no user and/or group called _mysql on your system, you can create them using the dscl command line utility, as described here.

  3. To start MySQL server automatically on system start, you'll need to install the MySQL Startup Item, then activate the checkbox in the preference pane, and if you followed steps 1 and 2, on next reboot, it should work like a charm!