The Python Database API is described in PEP 249. MySQL has three prominent drivers that implement the This API:
- MySQLdb is a native driver it has been developed and supported for over a decade by Andy Dustman.
- Mysqlclient is a fork in
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 This does not require the MySQL client library or any Python mo Dules outside the standard library.
All these drivers is thread-safe and provide connection pooling. Is the-one not MySQLdb
supporting Python 3 currently.
In addition to a DB API driver, Django needs an adapter to access the database drivers from its ORM. Django provides an adapter for mysqldb/mysqlclient while MySQL Connector/python includes its own.
Mysqlclient
Django requires Mysqlclient 1.3.3 or later. Note that Python 3.2 is not supported. Except for the Python 3.3+ support, mysqlclient should mostly behave the same as MYSQLDB.
python3+django1.11+mysql5.7 MySQL DB API Drivers