Django currently supports three MySQL drivers for MySQL links
MySQLdb is a native driver that have been developed and supported for Overa decade by Andy Dustman.
Mysqlclient is a fork of MySQLdb
which notably supports Python 3 Andcan being used as a drop-in replacement for MYSQLDB. At the time of this writing,this are the recommended choice for using MySQL with Django.
MySQL Connector/python is a pure Python driver from Oracle, does notrequire the MySQL client library or any Python mod Ules outside the standardlibrary.
MYSQLDB currently does not support python3+, it is recommended to use Mysqlclient
Tried to install mysqlclient directly on Pycharm, reported the following error: Oserror:mysql_config not found
Check the installation steps on Git:
Prerequisites
Need to install the Python and MySQL development headers and libraries as so:
sudo apt-get install python-dev libmysqlclient-dev
# Debian/ubuntu
sudo yum install python-devel mysql-devel
# Red Hat/centos
On Windows, there is binary wheel you can install without mysqlconnector/c or MSVC.
Note on Python 3:if you is using python3 then you need to install Python3-dev using the following command:
sudo apt-get install python3-dev
# Debian/ubuntu
sudo yum install python3-devel
# Red Hat/centos
brew install mysql-connector-c
# MacOS (Homebrew)
Install from PyPI
pip install mysqlclient
Because I'm using the Python3 on my Mac, I'm going to execute the command first:
brew install mysql-connector-c
And then do it again:
PIP3 Install Mysqlclient
The following error is reported:
Command "python setup.py egg_info" failed with error code 1 in/private/tmp/pip-build-m9v70gan/mysqlclient/
Oddly, after using the PIP3 command, the final call is Python, not python3
Django Install MySQL Driver