0

爲了說明這一點,我意識到這個問題已被問到before,但沒有達成任何解決方案。希望兩年能夠在理解這個問題上有所作爲。MySQL連接器/ Python接口錯誤:僅在特定主機上「解析EOF數據包失敗」

我試圖解決我在哪裏看到這個錯誤 mysql.connector.errors.InterfaceError: Failed parsing EOF packet.

這裏的問題是完整的鏈條:

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import mysql.connector as connector 
>>> sql = connector.connect(host='remote_host', user='user', password='pw', database='db') 
>>> cursor = sql.cursor() 
>>> sql.is_connected() 
True 
>>> cursor.execute("select * from associations") 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/mysql/connector/cursor.py", line 515, in execute 
    self._handle_result(self._connection.cmd_query(stmt)) 
    File "/Library/Python/2.7/site-packages/mysql/connector/connection.py", line 488, in cmd_query 
    result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query)) 
    File "/Library/Python/2.7/site-packages/mysql/connector/connection.py", line 407, in _handle_result 
    eof = self._handle_eof(self._socket.recv()) 
    File "/Library/Python/2.7/site-packages/mysql/connector/connection.py", line 344, in _handle_eof 
    eof = self._protocol.parse_eof(packet) 
    File "/Library/Python/2.7/site-packages/mysql/connector/protocol.py", line 269, in parse_eof 
    raise errors.InterfaceError(err_msg) 
mysql.connector.errors.InterfaceError: Failed parsing EOF packet. 

什麼奇怪的是,我也有一個本地數據庫設置與完全相同的結構,具有相同的信息,並且運行相同的命令字符串可以很好地工作。我的本地服務器版本是5.7.12 MySQL Community Server (GPL),而我嘗試連接的遠程服務器是4.1.22-log

從Python /連接器手動:

Connector/Python does not support the old MySQL Server authentication methods, which means that MySQL versions prior to 4.1 will not work.

是否 「之前」 包含或排除4.1嗎?如果排除,可能出現什麼問題的想法?

回答

0

從來沒有找到一個解決方案,這爲mysql.connector,但我發現了一個不同的連接器 - PyMySQL,完美的工作。甚至沒有改變語法。

相關問題