python mysql interfacing

David Brady dbrady at computer.org
Sat Feb 8 16:03:06 EST 2003


On Fri, 2003-02-07 at 10:29, vishnu mahendra wrote:
> is there a way in connecting python to mysql using mysql drivers.
> where can i find the drivers

Get the MySQLdb module.  It's hard to find, harder to install, and
nigh-impossible to decipher.  That said, getting Python to talk to your
MySQL database is so wonderful that it makes it all worth it.  Google
for MySQLdb, and pick the sourceforge site.

Here's what worked for me, on a RedHat 8 system:

1. apt-get install MySQL-python.  Getting the rpm didn't work (failed
dependencies without let or hindrance).

2. haul out Paul DuBois' book, "MySQL", and read the section on the C
API.

3. cd to /usr/lib/python2.2/site-packages/MySQLdb/ and read the source
of connections.py and cursors.py.

Was it painful?  Yes.  Is there an easier way?  I desperately hope so. 
Once you get it, does it work?  Yes.

Is it worth it?  Oh my, yes.  :-)

If anyone knows a less painful way of getting, setting up, and (still
relevant to my situation, even) finding documentation for the module,
I'd love to hear it.

Cheers,

-dB
-- 
David Brady
dbrady at computer.org
There are 10 kinds of people in the world: those who understand binary
and those who don't.






More information about the Python-list mailing list