Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble installing MySQL on Mavericks with Homebrew

I'm having trouble getting MySQL to install on Mavericks using Homebrew. I'm not a command-line ninja by any stretch, and since there seems to be no definitive set of instructions for installing MySQL on OS X, I sort of cobbled together instructions from these two spots:

http://madebyhoundstooth.com/blog/install-mysql-on-mountain-lion-with-homebrew/

http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial/

FWIW, I was able to get MySQL installed successfully on Mountain Lion using those two websites.

I'll detail my install steps below, and then bottom out at the error I'm getting. Hopefully, somebody with more command-line knowledge than what I possess will be able to spot my error(s).

First, at the suggestion of a website I read, I uninstalled MySQL, in case a previous version happened to be there. I did so like this (by the way, this all pre-supposes that I've installed Homebrew successfully):

brew remove mysql
cd /
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

When I ran the fourth line, I got this result:

launchctl: Couldn't stat("[my-home-directory]/Library/LaunchAgents/homebrew.mxcl.mysql.plist"): No such file or directory

Not sure if that mattered or not; perhaps the uninstall process already took care of that, or perhaps that file was never there in the first place. Either way, it didn't seem like a big problem, and everything appeared to uninstall properly.

So then I installed, like this:

brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql.server start

For what it's worth, I got the message "Already loaded" after running the third line above. When I ran mysql.server start, I got . SUCCESS! So that seems good, right?

Then I ran these two lines:

unset TMPDIR
mysql_install_db --verbose --user=`root` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

...and at this point, I got a steady stream of this in the terminal:

[ERROR] InnoDB: Unable to lock ./ibdata1, error: 35

I found this post, but it refers to a MAMP installation, which this is not, and when I searched my Mac for the two .pid files it references, I came up empty.

http://aralbalkan.com/1931/

So I'm kind of stumped. In another installation attempt from earlier, I was attempting to configure the default_socket in php.ini, based on the first URL I listed above, and I could find mysql.sock neither in the /tmp directory, nor did I find a MySQL directory in /var, so I have no idea what's going on.

Any help or guidance is greatly appreciated.

Thanks!

like image 236
hairbo Avatar asked Nov 13 '13 19:11

hairbo


1 Answers

Perform these steps:

 $ killall mysqld
 $ sudo rm -rf /usr/local/Cellar/mysql
 $ sudo rm -rf /usr/local/opt/mysql
 $ sudo rm -rf /usr/local/var/mysql
 $ brew install mysql 
 $ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
 $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
 $ brew cleanup
 $ mysql -uroot
like image 87
Sgryt87 Avatar answered Oct 12 '22 12:10

Sgryt87