try to define the parameters so
'ENGINE': 'django.db.backends.mysql',
'NAME': 'yourdbname',
'USER': 'root',
'PASSWORD': 'your password',
'HOST': '127.0.0.1',
'PORT': '3306',
El domingo, 6 de enero de 2013 05:42:21 UTC-5, ANKIT BAGARIA escribió:
>
>
> 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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.