Initially Django support Sqlit and Postgresql Database, but by installing the MySQL client package we can use MySQL database with the Django project.

So now I will describe the necessary configuration required to connect Django with the MySQL database.

Step - 1: Installing MySQL Client
Install MySQL client through pip using the command 

pip install mysqlclient

Step - 2: Setting Database Connection 
Open the settings.py file of the Django project. Here update the database connection settings as bellow

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test_dashboard', 'USER': 'test_user', 'PASSWORD': 'test_pass', 'HOST': 'localhost', 'PORT': '3306', } }
Here -
ENGINE : database engine.
NAME : database user name.
PASSWORD : database user password.
HOST : database server host.
PORT : database port.


Step - 3: Make Migrations
Now run the below commands - 

python manage.py makemigrations
python manage.py migrate


This will migrate all Django Models to MySQL schema.


This is how you can connect your Django web application with the MySQL database.


If this article was helpful leave a comment.