MySQL Connector Python 2003: Can't connect to MySQL server on

Viewed 33

I'm trying to connect to SQL Databases using mysql-connector-python but I'm facing errors during login:

I feel it's related to an issue with proxy or credentials, I can connect SQL database using Windows softwares like Excel but when it's with mysql-connector-python I have different type of error I'll show you:

First database using windows credentials on Excel works but on mysql-connector-python I have this error:

mydb = mysql.connector.connect(
    user="user_windows",
    password="password_windows",
    database="DDB_A"
)

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (10061 No connection could be made because the target machine actively refused it)

Second database using "database" credentials works with Excel too using different panel connection but with mysql-connector-python I have this error:

mydb = mysql.connector.connect(
    host="X.X.X.X",
    user="user_database",
    password="password_database",
    database="DDB_B"
)

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

InterfaceError: 2003: Can't connect to MySQL server on 'X.X.X.X:3306' (10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)
1 Answers

check your user table; select host,user from mysql.user;

Related