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