1

安装后,我可以连接到常规 MySQL 数据库,但不能连接到使用 SSL 的数据库 - 稍后我收到以下错误:

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',
    ]
)

即使我尝试安装 1.2.4 而不指定dependency_links,这也会失败。

我安装了头文件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命令初始化的。当通过相同的mysql版本安装数据库连接时sudo apt-get install python-mysqldb # 1.2.2-10build1 ,SSL连接在同一台机器上工作。

我还需要做什么才能迁移到基于 setuptools 的安装?

4

1 回答 1

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

于 2013-06-04T10:51:25.187 回答