How To Fix Interfaceerror: 2003: Can't Connect To Mysql Server On '127.0.0.1:3306:3306' (11001 Getaddrinfo Failed)
my MySQL connection is successful but ran into this interface errror import mysql.connector db=mysql.connector.connect( host='127.0.0.1:3306', user='root', passwd='tej
Solution 1:
Take the ":3306" out of the "host" line - mysql connector is adding the port in itself leading to an invalid address.
For future reference if you do need to specify a port then you can just specify a separate parameter like so:
import mysql.connector
db=mysql.connector.connect(
host="127.0.0.1",
port="3306",
user="root",
passwd="teja",
database="test"
)
You don't need to though - 3306 is the default MySQL port and it would appear that's what you are using.
Post a Comment for "How To Fix Interfaceerror: 2003: Can't Connect To Mysql Server On '127.0.0.1:3306:3306' (11001 Getaddrinfo Failed)"