问题
I'm trying to connect Python Application with online database. It's working properly on localhost database but when I try to connect with online it showing error.
Error
errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '69.162.107.34: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)
Code
import mysql.connector
mydb = mysql.connector.connect(
host="00.00.00.00",
user="user",
passwd="pass",
database="db"
)
mycursor = mydb.cursor()
来源:https://stackoverflow.com/questions/54830916/how-to-connect-python-application-with-online-database