Have you tried this.
Download the 64-bit DMG version of MySQL 5.1.x (or 5.5.x) for Mac OS X 10.6 from the official MySQL site and install the package, the startup item and the preference pane.
Add /usr/local/mysql/bin
to the path:
vim ~/.bash_profile
And add:
export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH
export EDITOR=vim
At the top of file. (Note that we set EDITOR whilst we are here so that svn is happy!)
Set up MySQL root password:
mysqladmin -u root password {new-password}
mysqladmin -u root -p{new-password} -h localhost password {new-password}
mysqladmin -u root -p{new-password} reload
Clear the history file by typing history -c so that {new-password} isn't in plain text on the disk.
Now ensure that the mysql.sock
file can be found by PHP:
Ensure that MySQL is running
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
According to the Homebrew Wiki, you need to use an Xcode version ≥ 4.1 when running OS X Lion.
They actually say …
Note that using an XCode older than 4.1 on 10.7 may cause build errors.
… but the "warning" message is probably misleading. Try updating Xcode to the latest version via the Mac App Store.
Best Answer
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
/usr/local/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
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
ormysql
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
, thenchown
it accordingly.Alternatively, you could start with a fresh data directory using
mysql_install_db
: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 thedscl
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!