Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed MySQL from:

I am on OS X 10.5.8. I open Terminal and do:

cd /usr/local/bin


mysql -u root

I get the following error:

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

I have spent the last 2 hours scouring sites looking for an answer that makes sense. This is a brand new laptop. I am at a loss. Here is my .bash_profile:

export PYTHONPATH=/Users/blwatson/pythonpath;/Users/blwatson/pythonpath/bin:$PYTHONPATH

# Setting PATH for MacPython 2.6
# The orginal version is saved in .bash_profile.pysave
export PATH


I am at a loss. The install order was:

1) Django 2) Python 2.6 3) MySQL 5

share|improve this question
up vote 1 down vote accepted

Check that the socket exists at /tmp/mysql.sock. If not, start mysql

sudo /usr/local/mysql/bin/mysqld_safe

Then try logging into the mysql client

/usr/local/mysql/bin/mysql -u root
share|improve this answer you now have me running. First, thank you. Second, what did you do exactly? Third, will I have to run that mysqld_safe command every time? I am a Windows guy and new to dev environment on Mac OS X. Quick learner, but still learning. – BrandonWatson Sep 19 '09 at 8:02
In the DMG is a file called MySql.prefPane. Run that and it will install a System Preferences pane that lets you control whether or not MySql starts on boot. – Stu Thompson Sep 19 '09 at 8:14
Wow...3 hours of frustration reduced to 6 lines of answers from ServerFault users. Thanks guys. Now I just have to sort out how to get PythonMySQL sorted. – BrandonWatson Sep 19 '09 at 8:22
I have found the mysql prefpane to be somewhat broken on 10.5, and I havn't even bothered with it on 10.6 (as it will be 32-bit). A better solution to autostart mysql is to create a launch daemon and submit it to launchd as described here: – Ryan Sep 20 '09 at 1:16

Did you start MySQL?

share|improve this answer
I don't know enough to answer that question. – BrandonWatson Sep 19 '09 at 8:00
Well, if you don't know if you started it, you probably didn't. ps aux|grep mysql if you didn't install the system preference pane off the DMG, do that, and use it to start MySQL. – Adam Jacob Muller Sep 20 '09 at 18:20

To start MySql go to System Preferences > MySql > Start

share|improve this answer
I do not see MySql in the System Preferences – BrandonWatson Sep 19 '09 at 8:02
Because that option is added to the System Preference panel if you install the MySQL package from the official site. – Ricky AH Dec 4 '09 at 11:47

Your Answer


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.