Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27094 > unrolled thread
| Started by | nepaul <xs.nepaul@gmail.com> |
|---|---|
| First post | 2012-08-15 06:30 -0700 |
| Last post | 2012-08-15 18:52 -0700 |
| Articles | 10 — 5 participants |
Back to article view | Back to comp.lang.python
_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
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 06:30 -0700 |
| Subject | _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host |
| Message-ID | <6a5212e3-4ff9-4cec-afe5-8b81e231eb67@googlegroups.com> |
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)")
[toc] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-15 15:23 +0100 |
| Message-ID | <mailman.3312.1345040537.4697.python-list@python.org> |
| In reply to | #27094 |
On 15/08/2012 14:30, 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)") > My highly paid team of consultants suggest that you're trying to connect to a MySQL server host that doesn't exist. However I'm sure that people on this list with more knowledge of MySQLDB than my consultants will be able to give you more detailed data. -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 07:53 -0700 |
| Message-ID | <mailman.3315.1345042433.4697.python-list@python.org> |
| In reply to | #27097 |
在 2012年8月15日星期三UTC+8下午10时23分24秒,Mark Lawrence写道: > On 15/08/2012 14:30, 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)") > > > > > > > My highly paid team of consultants suggest that you're trying to connect > > to a MySQL server host that doesn't exist. However I'm sure that people > > on this list with more knowledge of MySQLDB than my consultants will be > > able to give you more detailed data. > > > > -- > > Cheers. > > > > Mark Lawrence. if i use MySQLdb.connect(strCmd) -> wrong, but if use MySQLdb.connect(user = 'root', passwd = '123456', db = 'test', host = 'localhost'),it work. and the strCmd is read from a xml file.
[toc] | [prev] | [next] | [standalone]
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 07:53 -0700 |
| Message-ID | <f1da8301-fe8d-4067-8c05-69cfb2cb5420@googlegroups.com> |
| In reply to | #27097 |
在 2012年8月15日星期三UTC+8下午10时23分24秒,Mark Lawrence写道: > On 15/08/2012 14:30, 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)") > > > > > > > My highly paid team of consultants suggest that you're trying to connect > > to a MySQL server host that doesn't exist. However I'm sure that people > > on this list with more knowledge of MySQLDB than my consultants will be > > able to give you more detailed data. > > > > -- > > Cheers. > > > > Mark Lawrence. if i use MySQLdb.connect(strCmd) -> wrong, but if use MySQLdb.connect(user = 'root', passwd = '123456', db = 'test', host = 'localhost'),it work. and the strCmd is read from a xml file.
[toc] | [prev] | [next] | [standalone]
| From | Hans Mulder <hansmu@xs4all.nl> |
|---|---|
| Date | 2012-08-15 17:02 +0200 |
| Message-ID | <502bba24$0$6979$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #27094 |
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'. That's odd, since localhost should be your own computer. Which OS are you using? Is TCP/IP installed and enabled? Can you find an entry for 'localhost' in your /etc/hosts file? Can you ping it? What happens if you try host='127.0.0.1'? Incidentally, connecting as 'root' for non-administrative purposes is considered bad practice. Consider creating a 'test' account that only has access to the 'test' database. Oh, and I hope that '123456' is not really the password for 'root'. Hope this helps, -- HansM
[toc] | [prev] | [next] | [standalone]
| From | Alain Ketterlin <alain@dpt-info.u-strasbg.fr> |
|---|---|
| Date | 2012-08-15 17:22 +0200 |
| Message-ID | <878vdgp4c6.fsf@dpt-info.u-strasbg.fr> |
| In reply to | #27102 |
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. -- Alain.
[toc] | [prev] | [next] | [standalone]
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 09:50 -0700 |
| Message-ID | <cf7c5600-9fde-4ff0-bfd7-f63a5f1adf08@googlegroups.com> |
| In reply to | #27104 |
在 2012年8月15日星期三UTC+8下午11时22分49秒,Alain Ketterlin写道: > 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. > > > > -- Alain. Yeah!Great!Thanks!
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2012-08-15 12:58 -0400 |
| Message-ID | <mailman.3320.1345049888.4697.python-list@python.org> |
| In reply to | #27104 |
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/
[toc] | [prev] | [next] | [standalone]
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 18:52 -0700 |
| Message-ID | <7c2f8e49-e15f-43c5-8488-70309c08a4da@googlegroups.com> |
| In reply to | #27108 |
在 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/
[toc] | [prev] | [next] | [standalone]
| From | nepaul <xs.nepaul@gmail.com> |
|---|---|
| Date | 2012-08-15 18:52 -0700 |
| Message-ID | <mailman.3338.1345082589.4697.python-list@python.org> |
| In reply to | #27108 |
在 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/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web