mardi 28 juin 2016

Interface Error of mysql


I installed mysql connector/python and am using MAMP. When I try to connect to a database,this is what comes up in the terminal :

Traceback (most recent call last):
File "database.py", line 7, in <module>
    raise_on_warnings= True)
File "/Library/Python/2.7/site-packages/mysql/connector/__init__.py", line 179, in connect
        return MySQLConnection(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/Library/Python/2.7/site-packages/mysql/connector/abstracts.py", line 719, in connect
    self._open_connection()
  File "/Library/Python/2.7/site-packages/mysql/connector/connection.py", line 206, in _open_connection
    self._socket.open_connection()
  File "/Library/Python/2.7/site-packages/mysql/connector/network.py", line 475, in open_connection
    errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:8889:3306' (60 Operation timed out)

I tried going into the connector folder and checked out the network.py script and it seems the error is due to Interface Error. The documentation says:

This exception is raised for errors originating from Connector/Python itself, not related to the MySQL server.

errors.InterfaceError is a subclass of errors.Error

Here's my python script if required:

import mysql.connector

con = mysql.connector.connect(user='root',
                              password ='root',
                              host='localhost',
                              database='testdb',
                              raise_on_warnings= True)

cur = con.cursor()

cur.close()
con.close()

How to get rid of the interface error?


Aucun commentaire:

Enregistrer un commentaire