title: Error 2003 Can't connect to MySQL server on 'localhost' PyMySQL
body: <p>I'm not really sure what to do here. I'm trying to connect to MySQL Community Server by using a python script, and I'm running into an error message. This is being run on OS X Yosemite. I'm using the PyMySQL module, which imports correctly. The line</p>
  
  <pre><code>con = pms.connect(host='localhost',user='jaxon',passwd='password')
  </code></pre>
  
  <p>throws the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
  File "/Users/icefreak21/Documents/Python Files/DBConnector.py", line 4, in &lt;module&gt;
  con = pms.connect(host='127.0.0.1',user='root',passwd='c0c0_puFF')
  File "/Users/icefreak21/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymysql/__init__.py", line 88, in Connect
  return Connection(*args, **kwargs)
  File "/Users/icefreak21/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymysql/connections.py", line 644, in __init__
  self._connect()
  File "/Users/icefreak21/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymysql/connections.py", line 869, in _connect
  raise exc
  pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 61] Connection refused)")
  </code></pre>
  
  <p>I've searched around on the site and haven't found a question that details this particular situation. As far as I can tell, the server is running; the kicker is that I have no problem connecting through the command line with the same host, user, and password. I've tried switching the host name to '127.0.0.1' and I've tried specifying the port number (3306).</p>
  
  <p>I found one solution that suggested specifying the socket, but when I ran the suggested code</p>
  
  <pre><code>./mysqladmin variables | grep socket
  </code></pre>
  
  <p>to find the socket file to specify, I get the following error code:</p>
  
  <pre><code>./mysqladmin: connect to server at 'localhost' failed
  error: 'Access denied for user 'jaxon'@'localhost' (using password: NO)'
  </code></pre>
  
  <p>Does anyone have any other suggestions?</p>