Sharjeel
Sharjeel

Reputation: 15798

Upgraded from Lion to Mountain Lion and MySql stopped work

I recently upgraded to Mountain Lion OSX and my already working MySql has stopped working. When I try to run MySql in terminal all I get is the following error?

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Has anyone else faced the same problem?

Upvotes: 3

Views: 2094

Answers (1)

chiborg
chiborg

Reputation: 28094

I faced the same problem. The error is caused by MySQL not running. The Mac OS X installer removes the autostart item for MySQL. Here is what I've done:

  • Get the installer disk image (dmg) from mysql.org
  • Install MySQL, the autostart item and the control panel. To install them on a system with sandboxing on (default security settings) you'll have to control-click in the Finder and select "Open".
  • Check the control panel if mysql is running. Stop it.
  • In /usr/local/ you'll have two folders named "mysql-5.-osx10.6-x86_64", one from the old version and one from the new one. Move the data folder from the old to the new one with the sudo mv oldversion/data newversion/data command.
  • Start MySQL. You should now be able to use it again.

If you are using PHP and PHPMyAdmin, yopu'll have to install the mcrypt extension. Here is a step-by-step guide for that: http://remonpel.nl/2012/01/adding-mcrypt-to-your-osx-based-php-server-setup/

Upvotes: 1

Related Questions