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

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

最佳答案

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

https://stackoverflow.com/questions/54830916/

相关文章:

reactjs - 找不到模块 : Can't resolve 'react-native'

spring-boot - Liquibase 和 Hibernate ddl-auto=updat

angular7 - PrimeNG 表列排序不起作用

python - “Tensor”对象不能使用 Keras 和 seq2seq 模型调用

vue.js - 如何处理具有多个参数(例如表格数据)的查询的 Apollo 缓存更新

python - 无法关闭 gtk 对话窗口

java - 带有 Thymeleaf 的 IntelliJ (2018.3) - 静态内容路径上没

angular-material2 - Angular Material2 Mat-Table服务器

angularjs - Chrome 开发工具未映射 ts 源

.net - 如何在 .NET Core 的 IConfiguration 中获取自定义环境变量