this is a repost of my question at apple.stackexchange.com
I have installed MySQL via homebrew:
brew install mysql. I'd like to get the MySQL preference pane hooked up to my installation of MySQL through homebrew. How can I achieve this?
I've had the same issue. After googling my butt off, here's what I was able to find out:
install symlinks to Homebrew's MySQL installation in
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)
The preference pane attempts to start the MySQL server as user
_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 as well.
You can find out where your data directory is by looking for the entry
$(brew --prefix mysql)/support-files/mysql.server, then
chown it accordingly.
Alternatively, you could start with a fresh data directory using
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
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.
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!