如何将python应用程序与在线数据库连接

时间:2019-02-22 16:03:27

标签: python python-3.x mysqli database-connection

我正在尝试将Python应用程序与在线数据库连接。它在本地主机数据库上正常工作,但是当我尝试与在线连接时显示错误。

错误

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)

代码

import mysql.connector
mydb = mysql.connector.connect(
                host="00.00.00.00",
                user="user",
                passwd="pass",
                database="db"
            )

mycursor = mydb.cursor()

0 个答案:

没有答案