简体   繁体   English

MariaDB Python 中的连接器无法连接到远程服务器

[英]MariaDB connector in Python cannot connect to remote server

I was using the connection to the remote Mariadb server for months.几个月来,我一直在使用与远程 Mariadb 服务器的连接。 Today the connection couldn't be established anymore via the python mariadb module and the mariadb connector on macOS.今天,无法再通过 macOS 上的 python mariadb 模块和 mariadb 连接器建立连接。 The basic installation is as follows:基本安装如下:

brew install mariadb-connector-c
pip install mariadb

To connect to the server via python:通过 python 连接到服务器:

>>> import mariadb
>>> mariadb.connect(host="<IP>", port=3306)

The return is:回报是:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/<name>/miniconda3/lib/python3.8/site-packages/mariadb/__init__.py", line 142, in connect
    connection = connectionclass(*args, **kwargs)
  File "/Users/<name>/miniconda3/lib/python3.8/site-packages/mariadb/connections.py", line 83, in __init__
    super().__init__(*args, **kwargs)
mariadb.OperationalError: Can't connect to server on '<IP>' (60)

I can connect to the MariaDB server via the terminal mysql client (mysql -h ) as well as establish a connection using the telnet module:我可以通过终端 mysql 客户端(mysql -h)连接到 MariaDB 服务器,并使用 telnet 模块建立连接:

>>> import telnetlib 
>>> telnetlib.Telnet(host="<IP>", port=3306)

I also can connect to a locally installed mariadb server via python and the mariadb module.我还可以通过 python 和 mariadb 模块连接到本地安装的 mariadb 服务器。 Remote throws the above error though.远程虽然抛出上述错误。

Anyone an idea why the connection can't be established?有人知道为什么无法建立连接吗?

It's a bug which was introduced by a fix for CONC-607 (PR-204, commit dfe3563192e43a48bef3a861e72d9d122b9b346c).这是一个由 CONC-607 的修复程序引入的错误(PR-204,提交 dfe3563192e43a48bef3a861e72d9d122b9b346c)。 To track this issue please check CONC-612 on MariaDB Issue tracker.要跟踪此问题,请检查 MariaDB 问题跟踪器上的 CONC-612

Update (2022-09-02 10:07 CEST) : Issue is fixed (Connector/C 3.1.19 and 3.3.4)更新(2022-09-02 10:07 CEST) :问题已修复(连接器/C 3.1.19 和 3.3.4)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python Kafka客户端无法连接到远程Kafka服务器 - Python Kafka client cannot connect to remote Kafka server Python-Docker 容器无法连接到 MariaDB-Docker 容器 - Python-Docker container cannot connect to MariaDB-Docker container Docker 中的 Mariadb:MariaDB 连接器/Python 需要 MariaDB 连接器/C >= 3.2.4,找到版本 3.1.16 - Mariadb in Docker: MariaDB Connector/Python requires MariaDB Connector/C >= 3.2.4, found version 3.1.16 无法使用 python 连接到远程 MySql 数据库 - Cannot connect to Remote MySql database using python MariaDB 连接器 python 得到执行查询 - MariaDB connector python get executed query Ubuntu 20.04 上的 MariaDB 连接器/Python 安装问题( - MariaDB Connector/Python installation issue on Ubuntu 20.04 ( Docker中的mariadb python连接器如何使用? - How to use mariadb python connector in Docker? Python MySQL 连接器:无法使用 SSL 连接到服务器 - Python MySQL Connector: Can't connect to server with SSL MySQL 连接器 Python 2003:无法连接到 MySQL 服务器上 - MySQL Connector Python 2003: Can't connect to MySQL server on [pycharm remote python console]:导入pandas“无法连接到X服务器”错误 - [pycharm remote python console]: “cannot connect to X server” error with import pandas
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM