[英]How to connect python application with online database
我正在嘗試將 Python 應用程序與在線數據庫連接。 它在 localhost 數據庫上正常工作,但是當我嘗試在線連接時它顯示錯誤。
錯誤
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()
先連接你的工作台再試一次
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.