Python链接MySQL

  • MySQLdb is a native driver that has been developed and supported for over a decade by Andy Dustman

  • mysqlclient is a fork of MySQLdb which notably supports Python 3 and can be used as a drop-in replacement for MySQLdb. At the time of this writing, this is the recommended choice for using MySQL with Django.

  • MySQL Connector/Python is a pure Python driver from Oracle that does not require the MySQL client library or any Python modules outside the standard library.

粗略总结下,

MySQLdb 不支持Python3了,

mysqlclient是forkMySQLdb ,能支持Python3

1.两者都可以用import MySQLdb 来导包

2.安装前需要libmysqlclient-dev

mysql-connector-python 是MYSQL官方提供的驱动

源码安装:

1.https://pypi.python.org/pypi/MySQL-python

2.https://pypi.python.org/pypi/mysqlclient

3.https://pypi.python.org/pypi/mysql-connector-python

相关链接:

http://stackoverflow.com/questions/27748556/python3-4-cant-install-mysql-python

http://stackoverflow.com/questions/7475223/mysql-config-not-found-when-installing-mysqldb-python-interface

评论

暂无评论