title: Can't connect to localhost using Python's MySQLdb
body: <p>I'm new to this so probably have the wrong terminology but when I run the following script: </p>
  
  <pre><code>import MySQLdb
  
  conn = MySQLdb.connect (host = 'localhost',
     user = 'erin',
     passwd = 'erin',
            db = 'sec')
  </code></pre>
  
  <p>I get the error: </p>
  
  <pre><code>  File "/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/MySQLdb/__init__.py", line 81, in Connect
      return Connection(*args, **kwargs)
    File "/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/MySQLdb/connections.py", line 187, in __init__
      super(Connection, self).__init__(*args, **kwargs2)
  _mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")
  </code></pre>
  
  <p>There is no file called mysql.sock in that directory but I don't know what a socket is or how to specify the correct location for it using the MySQLdb module. </p>