gpt4 book ai didi

python - 使用 pandas 和 SQLAlchemy 外部访问 pythonanywhere MySQL 数据库

转载 作者:行者123 更新时间:2023-11-29 02:19:47 25 4
gpt4 key购买 nike

我想使用 pandas 从我的 pythonanywhere MySQL 数据库中读取数据。 pandas 使用 sqlalchemy

以下不起作用:

import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('mysql://user:pass@user.mysql.pythonanywhere-services.com/user$db_name')
pd.read_sql('SHOW TABLES from db_name', engine)

我收到一个错误:OperationalError: OperationalError: (OperationalError) (2003, "Can't connect to MySQL server on 'user.mysql.pythonanywhere-services.com' (10060)") 无 无

怎么了?或者 pythonanywhere 无法进行外部访问? (我正在使用免费计划)

最佳答案

PythonAnywhere 开发者在这里。不幸的是,您无法从服务外部连接到您的 PythonAnywhere 数据库。如果您有付费计划(附带 SSH 访问权限),那么您可以这样做 by using SSH tunnelling但这不适用于免费帐户。

关于python - 使用 pandas 和 SQLAlchemy 外部访问 pythonanywhere MySQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33737596/

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