gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:25:23 25 4
gpt4 key购买 nike

我正在尝试将 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()

最佳答案

先连接你的工作台再试一次

关于python - 如何将python应用程序连接到在线数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54830916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com