2013-06-04 31 views
1

安裝完畢後,我可以連接到一個普通的MySQL數據庫,而不是那些與SSL - 爲後來我收到以下錯誤:如何通過setuptools安裝支持SSL的MySQL-python?

File "build/bdist.linux-x86_64/egg/MySQLdb/__init__.py" in Connect 
    74.  return Connection(*args, **kwargs) 
File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py" in __init__ 
    170.   super(Connection, self).__init__(*args, **kwargs2) 

Exception Type: NotSupportedError at /shop/free_license/ 
Exception Value: client library does not have SSL support 

裏面我setup.py。我有

from setuptools import setup 

setup(
    ..., 
    install_requires = [ 'MySQL-python == 1.2.2' ], 
    dependency_links = [ 
     'http://downloads.sourceforge.net/project/mysql-python/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmysql-python%2Ffiles%2Fmysql-python%2F1.2.2%2F&ts=1370248965&use_mirror=surfnet', 
    ] 
) 

即使我嘗試在沒有指定dependency_links的情況下安裝1.2.4,也會失敗。

我有頭文件安裝sudo apt-get install libssl-dev

我的版本是:

$ uname -a 
Linux devzsoldosp 2.6.32-33-generiC#72-Ubuntu SMP Fri Jul 29 21:07:13 UTC 2011 x86_64 GNU/Linux 
$ python 
Python 2.6.5 (r265:79063, Oct 1 2012, 22:04:36) 
[GCC 4.4.3] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import setuptools 
>>> setuptools.__version__ 
'0.6c11' 
>>> 

的virtualenv中是用virtualenv testsetuptools命令初始化。當數據庫連接通過sudo apt-get install python-mysqldb # 1.2.2-10build1 安裝時,相同的mysql版本,SSL連接在同一臺機器上工作。

我還需要做些什麼才能移動到基於setuptools的安裝?

回答

0

驗證你的MySQL客戶端支持SSL:

mysql --ssl --help 

與同爲服務器:

mysql -u root -p 
mysql> show variables like "%ssl%"; 

按照說明建立安全連接:http://dev.mysql.com/doc/refman/5.1/en/ssl-connections.html

這裏有關如何使用Python庫創建與MySQL的SSL連接的更多信息:http://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html

python-mysqldb中存在一個問題1.2.3-1build1:https://bugs.launchpad.net/ubuntu/+source/python-mysqldb/+bug/1027075

+0

感謝您的回答!如上所述,事情的mysql方面是可以的,所以通過全局的,Ubuntu安裝的python-mysqldb包運行相同的示例代碼。我會看看1.2.3版本,但由於我使用的是舊版本,我最初的假設是,這不是問題(但會重複檢查,我以前錯了:)) – zsepi

+0

您能展示我你的Python代碼? – Glaslos