Connect Django with MySQL database

Install MySQL Client

From source

Download the source file mysqlclient-1.3.10.tar.gz. at mysqlclient and untar it.

tar xf mysqlclient-1.3.10.tar.gz

Then go into the extracted folder and install it:

cd mysqlclient-1.3.10/
sudo python3 build
sudo python3 install

pip install

# Instructions for Ubuntu
sudo apt-get install python3-dev libmysqlclient-dev
pip3 install mysqlclient

Turn on MySQL server

Connect with Django

Add to Django file

'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'PASSWORD': 'xxxx',
'HOST': 'localhost',
'PORT': '3306',

Run migrate command

In project folder:

python3 migrate