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 recently upgraded my iMac to Mavericks, and I realized I needed to reinstall MySQL. I installed the native DMG version and it was working well, and I should have left it there.

But I neglected it for a few weeks, and I was working on some Ruby tasks. I was having issues getting Ruby setup with homebrew, so I tried uninstalling MySQL and installing it with homebrew (using brew install mysql).

With this attempt I didn't realize anything was wrong until I was working locally on a site (a WordPress one) a few days later, and it was unable to create new tables, even though it was able to write to the existing tables. I tried rebooting, and at that point it seemed to be looking in a completely different place for the data folder, as it just had the default databases and none of the ones I had been working with.

Since then I've located and copied my original data folder in case I lose it, and have been trying to switch my MySQL installation, uninstall all of them, reinstall with homebrew, reinstall with the DMG, etc. and it has all been fruitless. I'm in over my head at this point (I'm a designer, primarily) and have been looking for ways to address.

I've observed that I can use the command ps auxww|grep [m]ysqld to see what processes I have (I can generally find my way around the command line), and I've done this with these results:

jonathanstegall  2390   0.0  5.4  3062688 449400   ??  S    12:32AM   0:02.05 /usr/local/Cellar/mysql/5.6.13/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.13 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.13/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/jonathaallsimac.err --pid-file=/usr/local/var/mysql/jonathaallsimac.pid

jonathanstegall  2304   0.0  0.0  2442580    968   ??  S    12:32AM   0:00.02 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1

jonathanstegall  7159   0.0  0.3  2619700  29072   ??  S     8:43PM   0:00.05 /usr/local/Cellar/mysql/5.5.15/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.5.15 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.5.15/lib/plugin --log-error=/usr/local/var/mysql/Jonathan-Stegalls-iMac.local.err --pid-file=/usr/local/var/mysql/Jonathan-Stegalls-iMac.local.pid

jonathanstegall  7114   0.0  0.0  2434388    964   ??  S     8:43PM   0:00.02 /bin/sh /usr/local/Cellar/mysql/5.5.15/bin/mysqld_safe

So clearly I have several processes running here, and I've just been unable to get it down to the proper number of processes and get one of them working. Any advice on how to do this?

Thanks,

share|improve this question

migrated from serverfault.com Nov 20 '13 at 12:47

This question came from our site for professional system and network administrators.

1 Answer 1

up vote 3 down vote accepted

I managed to resolve this issue. Here are the steps I took:

Before all this: I copied the data directory that contained all of my working databases onto my desktop. I don't remember the path of this one, but it really helped me not have to worry about the following steps.

  1. After running ps auxww|grep [m]ysqld, I ran killall mysqld and then ran ps auxww|grep [m]ysqld again, verifying that no processes were running.
  2. Run sudo rm -rf /usr/local/Cellar/mysql since a couple of those processes were homebrew and had Cellar paths.
  3. Run sudo rm -rf /usr/local/opt/mysql.
  4. Run sudo rm -rf /usr/local/var/mysql.
  5. Run sudo rm -rf /etc/my.cnf.
  6. Run brew install mysql.
  7. Run launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
  8. Run launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
  9. Run brew cleanup
  10. Run mysql -uroot

And at this point, I had a working homebrew MySQL installation again. I'm not entirely sure whether all of that was necessary, but it certainly got the right results.

share|improve this answer

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.