How to MySQl Database Connection in Django Python ?

Published On: 23/06/2022 | Category: Django Python

Hi Dev,

Here, I will show you how to mysql database connection in django. we will help you to give example of how to mysql database connection in django app. it's simple example of how to mysql database connection in django database. This article will give you simple example of how to mysql database connection in django example.

Here i will give you we will help you to give example of how to mysql database connection in django app. So let's see the bellow example:

Example

In this step, we will modify the settings.py file and update the database settings to configure the exampleapp database:

settings.py
DATABASES = {  
    'default': {  
        'ENGINE': 'django.db.backends.mysql',  
        'NAME': 'exampleapp',  
        'USER':'root',  
        'PASSWORD':'root',  
        'HOST':'localhost',  
        'PORT':'3306'  
    }  
}  

I Hope It will help you....