MySQL 和 Python (pyodbc):无法找到过程入口点 OPENSSL_sk_new_reserve
MySQL and Python (pyodbc): Procedure Entry Point OPENSSL_sk_new_reserve could not be located
我正在尝试从 Windows 10.
连接到远程(托管在 dreamhost 上)MySQL 数据库
我安装了最新版的32位MySQLODBC驱动(我是运行宁32位python)和运行下面的代码:
connection_string = (
r'DRIVER=MySQL ODBC 8.0 ANSI Driver;'
r'SERVER=https://mysql.mysite.com;'
r'DATABASE=dbname;'
r'UID=userid;'
r'PWD=password;'
r'charset=utf8mb4;'
)
cnxn = pyodbc.connect(connection_string)
cursor = cnxn.cursor()
显然使用正确的服务器、数据库名称、用户 ID 和密码。
我可以使用这些信息和凭据从 mysql workbench 访问它,但是当我 运行 上面的代码时,我收到此消息:
The procedure entry point OPENSSL_sk_new_reserve could not be
located in the dynamic link library c:\Program Files (x86)
MySQL\Connector ODBC 8.0\libssl-1_1.dll.
当我点击确定时,我在控制台中收到这条消息:
Traceback (most recent call last):
File "C:\Users\pasto\OneDrive\Documents\Python\work.py", line 129, in <module>
print(get_mysql_data())
File "C:\Users\pasto\OneDrive\Documents\Python\work.py", line 109, in get_mysql_data
cnxn = pyodbc.connect(connection_string)
pyodbc.InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded due to system error 127: The specified procedure could not be found. (MySQL ODBC 8.0 ANSI Driver, C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8a.dll). (160) (SQLDriverConnect)')
我尝试过的其他事情:
Google。我只找到了关于anaconda的东西,显然也有这个问题。
正在重命名 libssl_1-1.dll 库
然后错误代码变为
pyodbc.InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded
due to system error 126: The specified module could not be found.
(MySQL ODBC 8.0 ANSI Driver, C:\Program Files (x86)\MySQL\Connector ODBC
8.0\myodbc8a.dll). (160) (SQLDriverConnect)')
正在安装(通过 pip)mysql-connector,然后尝试
import mysql.connector
mydb = mysql.connector.connect(
host="https://mysql.mysite.com",
user="username",
password="password"
)
但这让我很感动
File "C:\Program Files (x86)\Python37-32\lib\site-packages\mysql\
connector\network.py", line 600, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL
server on 'https://mysql.fairplainpc.com:3306' (11001 getaddrinfo failed)
我已经做了好几个小时了,我几乎要放弃并使用请求库下载一个包含我想要的数据的 PHP 页面并解析它,但我真的更愿意让这个工作。
我在 mysql.com 上发现了其他人有类似错误的错误报告。
他们的解决方法是安装以前版本的 MySQL ODBC 驱动程序。他们安装了 5.3 驱动程序(截至 2020 年 7 月 21 日,可以从下拉列表中找到 here - select)。
我卸载了8,安装了5.3,驱动行改成
r'DRIVER=MySQL ODBC 5.3 ANSI Driver;'
效果立竿见影。
用你的数据试试这个connection_string:
connection_string = (
'DRIVER={MySQL ODBC 3.51 Driver};'
'SERVER=https://mysql.mysite.com;'
'DATABASE=dbname;'
'USER=userid;'
'PASSWORD=password;'
)
如果您自己运行 mysql 服务器,您可能需要将您的 IP 地址分配给您的数据库用户或将您的 IP 添加到排除项中。
例如 Hostpoint(瑞士):
我正在尝试从 Windows 10.
连接到远程(托管在 dreamhost 上)MySQL 数据库我安装了最新版的32位MySQLODBC驱动(我是运行宁32位python)和运行下面的代码:
connection_string = (
r'DRIVER=MySQL ODBC 8.0 ANSI Driver;'
r'SERVER=https://mysql.mysite.com;'
r'DATABASE=dbname;'
r'UID=userid;'
r'PWD=password;'
r'charset=utf8mb4;'
)
cnxn = pyodbc.connect(connection_string)
cursor = cnxn.cursor()
显然使用正确的服务器、数据库名称、用户 ID 和密码。
我可以使用这些信息和凭据从 mysql workbench 访问它,但是当我 运行 上面的代码时,我收到此消息:
The procedure entry point OPENSSL_sk_new_reserve could not be
located in the dynamic link library c:\Program Files (x86)
MySQL\Connector ODBC 8.0\libssl-1_1.dll.
当我点击确定时,我在控制台中收到这条消息:
Traceback (most recent call last):
File "C:\Users\pasto\OneDrive\Documents\Python\work.py", line 129, in <module>
print(get_mysql_data())
File "C:\Users\pasto\OneDrive\Documents\Python\work.py", line 109, in get_mysql_data
cnxn = pyodbc.connect(connection_string)
pyodbc.InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded due to system error 127: The specified procedure could not be found. (MySQL ODBC 8.0 ANSI Driver, C:\Program Files (x86)\MySQL\Connector ODBC 8.0\myodbc8a.dll). (160) (SQLDriverConnect)')
我尝试过的其他事情:
Google。我只找到了关于anaconda的东西,显然也有这个问题。
正在重命名 libssl_1-1.dll 库 然后错误代码变为
pyodbc.InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded
due to system error 126: The specified module could not be found.
(MySQL ODBC 8.0 ANSI Driver, C:\Program Files (x86)\MySQL\Connector ODBC
8.0\myodbc8a.dll). (160) (SQLDriverConnect)')
正在安装(通过 pip)mysql-connector,然后尝试
import mysql.connector
mydb = mysql.connector.connect(
host="https://mysql.mysite.com",
user="username",
password="password"
)
但这让我很感动
File "C:\Program Files (x86)\Python37-32\lib\site-packages\mysql\
connector\network.py", line 600, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL
server on 'https://mysql.fairplainpc.com:3306' (11001 getaddrinfo failed)
我已经做了好几个小时了,我几乎要放弃并使用请求库下载一个包含我想要的数据的 PHP 页面并解析它,但我真的更愿意让这个工作。
我在 mysql.com 上发现了其他人有类似错误的错误报告。
他们的解决方法是安装以前版本的 MySQL ODBC 驱动程序。他们安装了 5.3 驱动程序(截至 2020 年 7 月 21 日,可以从下拉列表中找到 here - select)。
我卸载了8,安装了5.3,驱动行改成
r'DRIVER=MySQL ODBC 5.3 ANSI Driver;'
效果立竿见影。
用你的数据试试这个connection_string:
connection_string = (
'DRIVER={MySQL ODBC 3.51 Driver};'
'SERVER=https://mysql.mysite.com;'
'DATABASE=dbname;'
'USER=userid;'
'PASSWORD=password;'
)
如果您自己运行 mysql 服务器,您可能需要将您的 IP 地址分配给您的数据库用户或将您的 IP 添加到排除项中。
例如 Hostpoint(瑞士):