By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,315 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,315 IT Pros & Developers. It's quick & easy.

MySQLdb Python API: Unable to connect

P: n/a
Hi,

I am using MySQL 5.0 beta and Active Python 2.4. I have the correct
version of MySQLdb installed. The problem is that I can't connect to
MySQL through the Active Python interactive window.

Here is a sample error:
c=MySQLdb.Connect(host='localhost',user='root',pas swd='',db='shop',port=3306) Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\MySQLdb\__init__.py", line 66, in
Connect
return Connection(*args, **kwargs)
File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", line
134, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

Please look at the penultimate line again. Here the self argument is
placed second to Connection argument. So I reversed their position. But
the problem persists.

Here is a sample:
c=MySQLdb.Connect(host='localhost',user='root',pas swd='',db='shop',port=3306)

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\MySQLdb\__init__.py", line 66, in
Connect
return Connection(*args, **kwargs)
File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", line
134, in __init__MyM
super(self,Connection).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

What is happening?

Thanks in advance for any help

Regards
Mondal

Dec 26 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Mondal" <ms******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,

I am using MySQL 5.0 beta and Active Python 2.4. I have the correct
version of MySQLdb installed. The problem is that I can't connect to
MySQL through the Active Python interactive window.

Here is a sample error:
c=MySQLdb.Connect(host='localhost',user='root',pas swd='',db='shop',port=3306
)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\MySQLdb\__init__.py", line 66, in
Connect
return Connection(*args, **kwargs)
File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", line
134, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

Please look at the penultimate line again. Here the self argument is
placed second to Connection argument. So I reversed their position. But
the problem persists.

Here is a sample:
c=MySQLdb.Connect(host='localhost',user='root',pas swd='',db='shop',port=3306
) Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\MySQLdb\__init__.py", line 66, in
Connect
return Connection(*args, **kwargs)
File "C:\Python24\Lib\site-packages\MySQLdb\connections.py", line
134, in __init__MyM
super(self,Connection).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost'
(10061)")

What is happening?


This is tardy, but if you are still interested -

You are accessing via 'localhost'. Yes ?
If so you need to remove port=3306.

Just leave the [port] parameter unspecified. "localhost" does not use it
and assigning it to 3306 is a conflict.

Test using the [mysql] command line utility by invoking it with the exact
same parameters.
In your case:
msyql -u'root' -p'' -h'localhost'
And make sure that works. If it does your MySQLdb should work.

By the way -
That password_less root logon is distressing if you are running on a server.
With no password on root, one would hope that "localhost" is the only
possible access and *you* are the only one who can touch the machine.

Thomas Bartkus


Jan 3 '06 #2

P: n/a
Hi All,

I sorted out the problem by reinstalling My SQL in another drive.

Regards

Jan 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.