![](/img/trans.png)
[英]The procedure entry point terminate could not be located in dynamic link library
[英]MySQL and Python (pyodbc): Procedure Entry Point OPENSSL_sk_new_reserve could not be located
我正在嘗試從 Windows 10 連接到遠程(托管在 dreamhost)MySQL 數據庫。
我安裝了最新版本的 32 位 MySQL ODBC 驅動程序(我正在運行 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 工作台訪問它,但是當我運行上面的代碼時,我收到以下消息:
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)')
谷歌。 我發現的只是關於 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 頁面,其中包含我想要的數據並進行解析,但我真的更願意完成這項工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.