我的域/Webspace等由Strato (https://www.strato.de)托管,我能够执行python脚本。该脚本在开发env (Windows 10)中非常好地工作--我能够连接到DB,没有任何问题。
但是在strato中,我收到了以下错误: 2003:无法连接到“MySQL”上的rdbms.strato.de:3306服务器(113没有到主机的路由)
有关守则:
....
import mysql.connector
....
try:
db_link = mysql.connector.connect(
host = "rdbms.strato.de",
user = "xxxx",
passwd = "yyyy"
)
except Exception as e:
print("The error raised is: ", e)
return
....但是我无法建立到数据库的连接(错误见上面).
使用的Python版本: sys.version_info(major=3,minor=8,micro=8,releaselevel='final',serial=0)
有什么想法吗?
事先非常感谢..。
发布于 2022-07-23 12:51:38
在尝试了许多不同的方法之后,我找到了一个解决方案(为Strato工作)。
错误是。……进口mysql.connector ..。
工作溶液
....
import MySQLdb
....
try:
db_link = MySQLdb.connect(
<host>,
<user>,
<passwd>,
<database>
)
except Exception as e:
print("The error raised is: ", e)
return
....也许这对某人有帮助..。
最诚挚的问候..。
发布于 2022-08-19 10:30:11
我被困在同一点上,但不能使用你的解决方案:
您为import MySQLdb安装了哪个软件包?“MySQL-连接器-python (8.0.30)”并没有提供这种功能,我总是回到"MySQL-python (1.2.5)“浏览几个站点--这没有帮助,因为它只支持Python2。我正在尝试几个不同的MySQL包,到目前为止都没有.
或者你必须在斯特拉图做什么特别的设置?
谢谢你,托比
编辑:从我的观点来看,只要您不订购一个显式的自己的服务器,它就不能工作……请参阅:https://www.strato.de/faq/hosting/gibt-es-bei-strato-einschraenkungen-bei-den-mysql-funktionen/
https://stackoverflow.com/questions/73085098
复制相似问题