Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27108

Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'arguments': 0.07; 'parsing': 0.07; '(its': 0.09; 'alain': 0.09; 'positional': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'recommends': 0.09; 'used)': 0.09; 'aug': 0.13; '"unknown': 0.16; '"user': 0.16; "'test',": 0.16; 'parameters,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sees': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; "shouldn't": 0.17; 'import': 0.21; 'keywords,': 0.22; 'parse': 0.22; 'host': 0.24; 'pass': 0.25; 'order.': 0.27; 'separate': 0.27; 'correct': 0.28; 'header:X -Complaints-To:1': 0.28; 'dictionary': 0.29; 'optional': 0.29; 'subject:: (': 0.29; 'writes:': 0.29; 'no,': 0.29; 'keyword': 0.30; 'code': 0.31; '(and': 0.32; 'could': 0.32; 'skip:_ 30': 0.32; '+0200,': 0.33; 'null': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'code:': 0.33; 'server': 0.35; 'list': 0.35; 'there': 0.35; 'received:org': 0.36; 'charset:us-ascii': 0.36; 'itself': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'space': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'subject:skip:_ 30': 0.84; 'dennis': 0.91; 'received:108': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
Date Wed, 15 Aug 2012 12:58:07 -0400
Organization > Bestiaria Support Staff <
References <6a5212e3-4ff9-4cec-afe5-8b81e231eb67@googlegroups.com> <502bba24$0$6979$e4fe514c@news2.news.xs4all.nl> <878vdgp4c6.fsf@dpt-info.u-strasbg.fr>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-79-220-220.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3320.1345049888.4697.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345049888 news.xs4all.nl 6966 [2001:888:2000:d::a6]:38530
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27108

Show key headers only | View raw


On Wed, 15 Aug 2012 17:22:49 +0200, Alain Ketterlin
<alain@dpt-info.u-strasbg.fr> declaimed the following in
gmane.comp.python.general:

> Hans Mulder <hansmu@xs4all.nl> writes:
> 
> > On 15/08/12 15:30:26, nepaul wrote:
> >> The code:
> >> import MySQLDB
> >> strCmd = "user = 'root', passwd = '123456', db = 'test', host = 'localhost'"
> >> 
> >> 
> >> 
> >> _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host 'user = 'root',
> >> passwd = '123456', db = 'test', host = 'localhost'' (11004)")
> >
> > This message means that the MySQL connector cannot find 'localhost'.
> 
> No, it means that connect received a single string "user = 'root'..."
> instead of a set of individual keyword parameters, and took the whole
> string to be the name of the host (its first parameter). Of course,
> there is no host with such a name.
> 
> The solution is to parse the string into individual values, and pass
> these in the correct order.

	MySQLdb code itself recommends to always use keyword parameters, so
the order shouldn't be significant... (and when one sees the list of
optional keywords, using null commas to space positional arguments would
be insane)

	Parsing that string into separate fields (preferably a dictionary so
**conectitems could be used) OTOH is critical.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

_mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 06:30 -0700
  Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-15 15:23 +0100
    Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 07:53 -0700
    Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 07:53 -0700
  Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host Hans Mulder <hansmu@xs4all.nl> - 2012-08-15 17:02 +0200
    Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2012-08-15 17:22 +0200
      Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 09:50 -0700
      Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-15 12:58 -0400
        Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 18:52 -0700
        Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host nepaul <xs.nepaul@gmail.com> - 2012-08-15 18:52 -0700

csiph-web