Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed MySQL using Homebrew on my Snow Leopard Mac OS 10.6. I have run through the commands that it mentions:

unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

But when I connect and try to list databases (or take any other action) I get errors:

$ mysql
mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)

I tried searching for an answer to the error, but couldn't find anything to help me resolve this issue. What do I need to do to set this up correctly?

FYI: I might have manually installed MySQL at one point. Not sure if there are any remaining files that are conflicting.

share|improve this question
up vote 1 down vote accepted

It looks like I did have a previous MySQL installation that was conflicting. Looks like it was even running too.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql
brew uninstall mysql

sudo launchctl unload /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo rm /Library/LaunchDaemons/com.mysql.mysqld.plist

This tutorial helped me remove all traces of the previous installation:

sudo nano /etc/hostconfig
# remove this line: MYSQLCOM=-YES-

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf

Then I reinstalled MySQL through homebrew and everything is good:

brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .