Monday, February 28, 2011

python mysqldb installation problem

OS: Ubuntu 10.04
I am learning web developing with Django.I downloaded and installed
python-mysql but i couldn't connect.I think problem is database
Here is the process: startproject mysite #creating a project and a mysite

files in 'mysite' folder:

Then i edited the '' file.There are alse database settings
in it.

Here are the settings:


then i write the codes below with terminal:

python shell

from django.db import connection

Then the error occurs as:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/", line 99, in cursor
self.connection = Database.connect(**kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/", line 74,
in Connect
return Connection(*args, **kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/", line
170, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2002, "Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)")

It looks like that error occurs from DATABASE_HOST but i don't think
so because when using MySQL DATABASE_HOST may be left blank

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment