Skip to main content

Using MySQL db with Django

 Django officially supports these databases: PostgreSQL, MariaDB, MySQL, Oracle, SQLite.

Connect django project with MySQL.

  •     In settings.py write this

        DATABASES = {
            'default': {
                'ENGINE': 'django.db.backends.mysql',
                'NAME': 'link_verse_db',
                'USER': 'user_name',
                'PASSWORD': 'password',
                'HOST': 'localhost',  # Use '127.0.0.1' if you have issues with 'localhost'
                'PORT': '3306',       # MySQL default port
            }
        }


  • My requirement was to connect to MySQL and also to be able to see all the models (tables) including Django's build in models on workbench.

Comments

Popular posts from this blog

First Django Project

Django is a Python-based web framework that allows you to quickly create efficient web applications. It is also called batteries included framework because Django provides built-in features for everything including Django Admin Interface, default database – SQLlite3, etc.

LinkedList

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers. In simple words, a linked list consists of nodes where each node contains a data field and a reference(link) to the next node in the list.