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


Groups > comp.lang.python > #27134

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

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <xs.nepaul@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'arguments': 0.07; 'parsing': 0.07; '(its': 0.09; 'alain': 0.09; 'positional': 0.09; 'recommends': 0.09; 'to:addr:comp.lang.python': 0.09; 'used)': 0.09; 'cc:addr:python-list': 0.10; 'aug': 0.13; '"unknown': 0.16; '"user': 0.16; "'test',": 0.16; 'parameters,': 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; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'host': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'order.': 0.27; 'separate': 0.27; 'correct': 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; 'code:': 0.33; 'received:google.com': 0.34; 'server': 0.35; 'list': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'itself': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'space': 0.39; 'first': 0.61; '8bit%:60': 0.84; 'subject:skip:_ 30': 0.84; 'dennis': 0.91; 'received:209.85.220.184': 0.91
Newsgroups comp.lang.python
Date Wed, 15 Aug 2012 18:52:29 -0700 (PDT)
In-Reply-To <mailman.3320.1345049888.4697.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=113.106.106.98; posting-account=gm5T0QoAAADsrQB6lKn4dmNQxJ9E7E9m
References <6a5212e3-4ff9-4cec-afe5-8b81e231eb67@googlegroups.com> <502bba24$0$6979$e4fe514c@news2.news.xs4all.nl> <878vdgp4c6.fsf@dpt-info.u-strasbg.fr> <mailman.3320.1345049888.4697.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 113.106.106.98
MIME-Version 1.0
Subject Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
From nepaul <xs.nepaul@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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>
Message-ID <mailman.3338.1345082589.4697.python-list@python.org> (permalink)
Lines 80
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345082589 news.xs4all.nl 6852 [2001:888:2000:d::a6]:35660
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27134

Show key headers only | View raw


在 2012年8月16日星期四UTC+8上午12时58分07秒,Dennis Lee Bieber写道:
> 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:
> 
> > 
> 
Right!
> > > 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 | 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