472,115 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,115 software developers and data experts.

MySQLdb Python API: Unable to connect

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
2 4389
"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
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.

Similar topics

5 posts views Thread by Chris Stromberger | last post: by
1 post views Thread by Sheila King | last post: by
1 post views Thread by Peter Nikolaidis | last post: by
1 post views Thread by Derek Fountain | last post: by
21 posts views Thread by John Fabiani | last post: by
2 posts views Thread by Daniel Baggott | last post: by
4 posts views Thread by Mondal | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.