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 <alamin15-944@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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CALKGVipp4b%2Bhq9gcP7k-RSMeKkRg-QO%2BcRgOj3aH5__2yQtMbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment