DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'django', # Or path to database file if using sqlite3. 'USER': 'name', # Not used with sqlite3. 'PASSWORD': 'pass', # Not used with sqlite3. 'HOST': '/var/run/mysql', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } }
this is my setting in settings.py file. I have Mysql server running .Now I run *python manage.py shell *to start python interpreter. Then in the interreter I type the following command *to check the connection to database *: >>>from django.db import connection >>>cursor = connection.cursor() and it gives me the *following error*: Traceback (most recent call last): File "<console>", line 1, in <module> File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 306, in cursor cursor = self.make_debug_cursor(self._cursor()) File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 38 7, in _cursor self.connection = Database.connect(**kwargs) File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect return Connection(*args, **kwargs) File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __in it__ super(Connection, self).__init__(*args, **kwargs2) OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)") * I am using windows 7.* *please help me fix it. it is driving me crazy. I have googled it, gone through different forums but am not able to fix it. Please help me.* *thankyou.* -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ejeVMh2eIiAJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.