How to use mysql-connector mysql adapter with django??/

218 views Asked by At

I cannot use mysqlclient package in the hosting server because it is a shared hosting server and they would not let me have a root privilige!! so I found about the mysql-connector adapter, I guess it is developed by MySQL but I could not find anyone using it to connect to the database, does someone know how to use it?? please help

1

There are 1 answers

2
Darsh Modi On
  • First of all you have to run the command pip install mysqlclient after that change your settings.py file with this code.

    DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'DB_NAME', 'USER': 'root', 'PASSWORD': 'root', 'HOST': 'Your host', 'PORT': 3306 } }

  • I think it should work for you. But would like to inform you that some of the hosting servers mostly support the Postgresql rather than the MySQL DB.