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 setup.py build
sudo python3 setup.py 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 settings.py
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER':'root',
'PASSWORD': 'xxxx',
'HOST': 'localhost',
'PORT': '3306',
Run migrate command
In project folder:
python3 manage.py migrate
Reference:
* https://github.com/PyMySQL/PyMySQL