MySQL Forums
Forum List  »  Connector/Python

Re: MySql Python connection error
Posted by: Dariusz Suchojad
Date: April 26, 2009 12:15PM

Vidyadhar Tilve Wrote:
-------------------------------------------------------
> self.conn = MySQLdb.connect (host = "192.168.0.175",user = "pipeline",db = "rocket")
> File "build/bdist.linux-x86_64/egg/MySQLdb/__init__.py", line 74, in Connect
> File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py", line 129, in __init__
> File "build/bdist.linux-x86_64/egg/MySQLdb/converters.py", line 160, in <module>

> I am getting the above errors

Well, strictly speaking, the above messages aren't errors at all. It seems
you haven't copied & pasted all the relevant information.

See the below sample interactive session with a Python interpreter. Here you
can observe a Python exception being raised when trying to connect as
a non-existing user to a non-existing database on host 127.0.0.1. Can you,
please, do the same, after substituing 192.168.0.175 for 127.0.0.1,
and paste it all here?

$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.connect(host="127.0.0.1", user="pipeline", db="rocket")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/lib/python-support/python2.5/MySQLdb/__init__.py", line 74, in Connect
return Connection(*args, **kwargs)
File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line 170, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'pipeline'@'localhost' (using password: NO)")
>>>

> I am using python 2.4.3 and MySql version 5.0.45

Why are you using such old versions? If it's a Linux box, can you upgrade the
packages to most recent ones? I doubt it will help you but it won't do any harm,
Python 2.4.x line is, you know, 4 year old now. If you intend to use Python 2.4
then you should upgrade to a 2.4.6 bugfix release. MySQL 5.0.45 is also almost a
2 years old version.

Also, what's your MySQLdb version? You can check it by typing
MySQLdb.version_info in the Python shell, as in:

$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.version_info
(1, 2, 2, 'final', 0)
>>>

--
Dariusz Suchojad

gefira / the knowledge company
http://www.gefira.pl

Options: ReplyQuote


Subject
Written By
Posted
Re: MySql Python connection error
April 26, 2009 12:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.