How to connect python application with online database

醉酒当歌 提交于 2019-12-30 10:51:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!