I installed MySQL from:

http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg

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

cd /usr/local/bin

then:

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
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
export

PATH=/usr/local/mysql/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

I am at a loss. The install order was:

1) Django 2) Python 2.6 3) MySQL 5

link|improve this question
feedback

3 Answers

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
link|improve this answer
OK...so 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: macosxhints.com/article.php?story=20080128103022907 – the_snitch Sep 20 '09 at 1:16
feedback

Did you start MySQL?

link|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
feedback

To start MySql go to System Preferences > MySql > Start

link|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
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.