简体   繁体   中英

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?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM