Connect with Mysql database

68 views
Skip to first unread message

Nishprovo Alamin

unread,
Apr 28, 2019, 7:33:10 PM4/28/19
to Django users
I can't connect Mysql database with my Django project. When I write this command in windows powershell, "pip install mysql" then an error shows. It's told to install visual c++ 14.0... I already installed it and restart my computer but that dosen't work. Same error shows again and again. I also tried "pip install mysqliclient". But that dosen't work also. Is there any solution for this..?

Irfan Khan

unread,
Apr 28, 2019, 11:42:06 PM4/28/19
to django...@googlegroups.com

hi,  first install 


pip3 install PyMySQL


or 


pip install pymysql




after then


 put this code in  __init__.py



import pymysql

pymysql.install_as_MySQLdb()



and for connection put this code in settings.py


DATABASES = {

    'default': {

        'ENGINE': 'django.db.backends.mysql',

        'NAME': 'database name',

'USER': 'root',

'PASSWORD': 'root',

'HOST': 'localhost',

'PORT': '3306',

    }

}









On Mon, 29 Apr 2019 at 5:02 AM, Nishprovo Alamin <alamin...@diu.edu.bd> wrote:
I can't connect Mysql database with my Django project. When I write this command in windows powershell, "pip install mysql" then an error shows. It's told to install visual c++ 14.0... I already installed it and restart my computer but that dosen't work. Same error shows again and again. I also tried "pip install mysqliclient". But that dosen't work also. Is there any solution for this..?   

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/38f7cee0-bf13-4beb-8a27-76ef0808e96c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
With Regards,

Irfan khan
Aripl-hse
bits hyd
Mobile : +91 8008469093


Reply all
Reply to author
Forward
0 new messages