Python MySQL.connect() question

Boudewijn Rempt boud at rempt.xs4all.nl
Sun Jan 30 03:43:27 EST 2000


Jim Conger <jimc at regnoc.com> wrote:
> I have mySQL running on a RH Linux 6.1 box, and have added the
> MySQLmodule.so to my python library.  I can't figure out how to connect
> within python.  My attempts look like:

>>>> import MySQL;
>>>> db = MySQL.connect();
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> MySQL.error: Can't connect to local MySQL server
>>>>

I'm not really surprised - I think you need to supply
some parameters:

    hostname="essle"
		username="boud"
		password=""
		databasename="languages"
    self.dbConnection = MySQL.connect(hostname,username,password)
	  self.dbConnection.selectdb(databasename)
				
Which is what I did when I used MySQLmodule; however, I've since
began using the DB-API II compliant MySQLdb, but I miss some of
the conveniences of MySQLmodule.

-- 

Boudewijn Rempt  | http://www.valdyas.org



More information about the Python-list mailing list