Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 0 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.