Django Syncdb Error



I’m getting the following error when I run the syncdb command for the first time. I set up Django using Jeff Croft’s guide and am stumped.

The error: syncdb
Traceback (most recent call last):
File “/home/mysite/django/django_src/django/bin/”, line 5, in ?
File “/home/mysite/django/django_src/django/core/”, line 1571, in execute_from_command_line
action_mapping[action](int(options.verbosity), options.interactive)
File “/home/mysite/django/django_src/django/core/”, line 486, in syncdb
from django.db import connection, transaction, models, get_creation_module
File “/home/mysite/django/django_src/django/db/”, line 11, in ?
backend = import(‘django.db.backends.%s.base’ % settings.DATABASE_ENGINE, {}, {}, [’’])
File “/home/mysite/django/django_src/django/db/backends/mysql/”, line 20, in ?
raise ImportError, “MySQLdb-1.2.1p2 or newer is required; you have %s” % Database.version
ImportError: MySQLdb-1.2.1p2 or newer is required; you have 1.2.1g3

I would appreciate it if anyone could help out.

Thanks in advance,


Hi Rich,
While I still haven’t got Django up and running while using the Wiki and Jeff Crofts guide I did run across this error and was able to get around it.

The problem is that the python version of MySQLdb is old, so I installed the newer version directly. After that I had no issues with the syncdb.

To install I used the tutorial section on MySQLdb from
Just the MySQLdb section though, obviously the rest is not useful.

Best of luck,


I tried that but still get the same error. I did get a 404 error on the wget link in the tutorial but downloaded and installed the latest version of MySQLdb.



Was the new MySQLdb in a location that python could get to, aka in the PYTHONPATH?

for example my mysqldb resides in lib/python2.6/site-packages and in the PYTHONPATH I have
export PYTHONPATH=$HOME/django/django_src:$HOME/django/django_projects:$HOME/lib/python2.6/site-packages:$PYTHONPATH


I updated the PYTHONPATH and was able to run the syncdb but when I tried to hit my subdomain I received the same error about the MySQLdb version.

I did a Google search and found this link:

I checked out the latest version of Django (ver 4828) and now it works.

Thanks for the help and I hope this helps others.