在 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. -- http://mail.python.org/mailman/listinfo/python-list