Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My boss update my computer to Snow Leopard, after the update we had a set back and deleted a few files/folders, since then is just nightmare after another one. I finally getting things back but I'm still having problems with MySQL. This is what I did:

  1. Deleted ALL of mysql files/folders
  2. Download and installed the packages mysql-5.1.45-osx10.6-x86_64.dmg
  3. installed the Startup item and the preferences panel

After the above, I tried to start MySQL from the preferences panel without luck, and running the following command from Terminal

/usr/local/mysql/bin/mysql

I get the following result

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

I looked at some other post for possible solutions, but what they does not exactly fits my problem, so I cannot find a solution.

I'm new to all this and your help will be much appreciated.

share|improve this question

3 Answers 3

ERROR 2002 is usually caused by mysqld not running. Did you install and start the server? If so, then restart it as the socket may be missing for some reason.

share|improve this answer
    
thanks for the response, this lead me to the right solution –  Ole Media Apr 6 '10 at 21:30

Sometimes the mysql socket file is located at /var/mysql/mysql.sock on OS X. Try:

ln -s /var/mysql/mysql.sock /tmp/mysql.sock
share|improve this answer

Here is the solution to my particular problem:

MySQL has a Preferences pane but I think it might not work on Snow Leopard. So the error I was getting is due to the fact the most likely installing just mysql it doesn't start the daemon. To start the deamon, I used launchd plist. If you do a Google search for Snow Leopard, MySQL and launchd, there are a number of articles out there.

A website that I found, had these instructions:

HiveLogic comes to the rescue with a preconfigured plist for launchd. (Or you could just set it up by hand or with Lingon)

Head to your temp directory and do the following. (Any directory will do – just make sure you delete the files afterwards. I have a ~/temp directory for this sort of stuff.)

curl -O http://hivelogic.com/downloads/com.mysql.mysqld.plist
sudo mv com.mysql.mysqld.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist

MySQL should now run on startup. To start it now (so you don’t need to reboot) do the following:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

If no errors are reported things are probably working.

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.