Junchao Gu
Junchao Gu

Reputation: 1865

Django: cannot connect to mysql

I am new to Django and I try to follow the official tutorial. since I want to connect to mysql (installed on my computer, and i checked mysql module does exit in python command line), I set the ENGINE in setting.py to be django.db.backends.mysql . and then I tried to run

    python manage.py syncdb

then I got error message like this:

   Error loading MySQLdb module

and I cannot run

   pip install mysql-python

the error msg is:

   Unable to find vcvarsall.bat

so what is this error? and honestly I am not sure about the difference between mysql-python and mysql-connector-python. Since i tried with "pip install mysql-connector-python" and it tells me that requirement already satisfied...

Upvotes: 0

Views: 329

Answers (2)

Burhan Khalid
Burhan Khalid

Reputation: 174624

You need to download the windows binary installer for the MySQL drivers for Python. Installing from source will not work since you do not have the development headers in Windows.

Upvotes: 2

eran
eran

Reputation: 6921

You need to install the mysql python connector

sudo apt-get install python-mysqldb

Upvotes: 0

Related Questions