mysqldb help! Can't connect to MySQL server error...

517 views
Skip to first unread message

mdsmoker

unread,
Aug 2, 2009, 9:16:49 PM8/2/09
to Django users
when running python manage.py syncdb I got the following errors...

C:\DJANGO~1\mysite>python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "c:\django-trunk\django\core\management\__init__.py", line 362,
in execut
e_manager
utility.execute()
File "c:\django-trunk\django\core\management\__init__.py", line 303,
in execut
e
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\django-trunk\django\core\management\base.py", line 195, in
run_from_a
rgv
self.execute(*args, **options.__dict__)
File "c:\django-trunk\django\core\management\base.py", line 221, in
execute
self.validate()
File "c:\django-trunk\django\core\management\base.py", line 249, in
validate
num_errors = get_validation_errors(s, app)
File "c:\django-trunk\django\core\management\validation.py", line
67, in get_v
alidation_errors
connection.validation.validate_field(e, opts, f)
File "c:\django-trunk\django\db\backends\mysql\validation.py", line
15, in val
idate_field
db_version = connection.get_server_version()
File "c:\django-trunk\django\db\backends\mysql\base.py", line 297,
in get_serv
er_version
self.cursor()
File "c:\django-trunk\django\db\backends\__init__.py", line 81, in
cursor
cursor = self._cursor()
File "c:\django-trunk\django\db\backends\mysql\base.py", line 281,
in _cursor
self.connection = Database.connect(**kwargs)
File "C:\Python25\lib\site-packages\MySQLdb\__init__.py", line 74,
in Connect
return Connection(*args, **kwargs)
File "C:\Python25\lib\site-packages\MySQLdb\connections.py", line
170, in __in
it__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL
server on 'lo
calhost' (10061)")

I have mysqldb 1.2.2 installed w/out errors. I think I'm just missing
something pretty simple. If it helps, this is what my settings.py
looks like...

DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mysitedb' # Or path to database file if
using sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = 'blue33' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '3036' # Set to empty string for default.
Not used with sqlite3.

Karen Tracey

unread,
Aug 2, 2009, 10:21:07 PM8/2/09
to django...@googlegroups.com
On Sun, Aug 2, 2009 at 9:16 PM, mdsmoker <mdsm...@hotmail.com> wrote:

when running python manage.py syncdb I got the following errors...

C:\DJANGO~1\mysite>python manage.py syncdb
Traceback (most recent call last):
[snip] 
  super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL
server on 'lo
calhost' (10061)")

10061 is Winsock connection refused.  There is no program listening on the port/host you are trying to connect to.
 

I have mysqldb 1.2.2 installed w/out errors.  I think I'm just missing
something pretty simple.  If it helps, this is what my settings.py
looks like...

DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mysitedb'             # Or path to database file if
using sqlite3.
DATABASE_USER = 'root'             # Not used with sqlite3.
DATABASE_PASSWORD = 'blue33'         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '3036'             # Set to empty string for default.
Not used with sqlite3.

Why have you specified port 3036?  The default MySQL port is 3306, so unless you have configured your server to use this other port, that DATABASE_PORT setting explains the failure to connect.  Assuming you have not specially configured your MySQL server to listen on a non-standard port, it's best to just leave DATABASE_PORT empty and let the default one be used automatically.

Karen



 



mdsmoker

unread,
Aug 4, 2009, 11:25:53 PM8/4/09
to Django users

> Why have you specified port 3036?

-cause i'm partially retarded, that's all...thanks for your help

Matt

Melvyn Sopacua

unread,
Jul 5, 2012, 8:53:50 AM7/5/12
to django...@googlegroups.com
On 4-7-2012 21:31, Matthew Piatkowski wrote:
>> DATABASE_PORT = '3036' # Set to empty string for default.
>> Not used with sqlite3.
>>
Typo that should probably 3306.

--
Melvyn Sopacua


Tom Evans

unread,
Jul 5, 2012, 9:45:55 AM7/5/12
to django...@googlegroups.com
On Thu, Jul 5, 2012 at 1:53 PM, Melvyn Sopacua <m.r.s...@gmail.com> wrote:
> On 4-7-2012 21:31, Matthew Piatkowski wrote:
>>> DATABASE_PORT = '3036' # Set to empty string for default.
>>> Not used with sqlite3.
>>>
> Typo that should probably 3306.
>

I'm sure the guy from 2009 that he is quoting will be glad for the correction…

Sergiy Khohlov

unread,
Jul 5, 2012, 9:59:10 AM7/5/12
to django...@googlegroups.com
Could you please connect to mysql from console. Is it OK ?

Look like
mysql is not started
you connect to wrong port
connect from network is blocked
credentials are wrong

2012/7/5 Tom Evans <teva...@googlemail.com>:
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

Tom Evans

unread,
Jul 5, 2012, 10:01:54 AM7/5/12
to django...@googlegroups.com
On Thu, Jul 5, 2012 at 2:59 PM, Sergiy Khohlov <skho...@gmail.com> wrote:
> Could you please connect to mysql from console. Is it OK ?
>
> Look like
> mysql is not started
> you connect to wrong port
> connect from network is blocked
> credentials are wrong
>

Seriously? WTF? This is a thread from April 2009, the OP is not still
trying to connect to mysql, nor is he likely to read the response
telling him he leaked his mysql root password on the internet. No more
replies are required...

Cheers

Tom

Sergiy Khohlov

unread,
Jul 5, 2012, 10:04:03 AM7/5/12
to django...@googlegroups.com
WOW !!!!! I forget about date ! Sorry

2012/7/5 Tom Evans <teva...@googlemail.com>:

Melvyn Sopacua

unread,
Jul 5, 2012, 10:06:39 AM7/5/12
to django...@googlegroups.com
> I'm sure the guy from 2009 that he is quoting will be glad for the correction�
>
Typos have a nasty habit of showing up more than once, but yeah I missed
the date. Unless mr Piatkowski provides info specific to his problem,
I'm out of this thread.

--
Melvyn Sopacua


Reply all
Reply to author
Forward
0 new messages