3

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

con = pms.connect(host='localhost',user='jaxon',passwd='password')

throws the following error message:

Traceback (most recent call last):
File "/Users/icefreak21/Documents/Python Files/DBConnector.py", line 4, in <module>
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)")

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).

I found one solution that suggested specifying the socket, but when I ran the suggested code

./mysqladmin variables | grep socket

to find the socket file to specify, I get the following error code:

./mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'jaxon'@'localhost' (using password: NO)'

Does anyone have any other suggestions?

1 Answers1

-2

I had the same problem. I solved it by changing the port. You can add your port like this:

3307(port = 3307)

I'm recommending this because the mysql port of mac vision might be 3307.

armatita
  • 10,150
  • 6
  • 43
  • 44
M.Hoo
  • 1
  • 1