Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion _mysql_exceptions.OperationalE rror: (2005, "Unknown MySQL server host
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alain Ketterlin  
View profile  
 More options Aug 15 2012, 11:22 am
Newsgroups: comp.lang.python
From: Alain Ketterlin <al...@dpt-info.u-strasbg.fr>
Date: Wed, 15 Aug 2012 17:22:49 +0200
Local: Wed, Aug 15 2012 11:22 am
Subject: Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host

Hans Mulder <han...@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.

-- Alain.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.