Installing MySQL + MySQLdb in OS 10.5 (Leopard)
Anyone that is a python developer and that uses mysql will tell you getting MySQLdb can sometimes be a bit of a pain, and every time I reinstall my system I have to dig around to find the instructions to build it properly.So this time I thought I would document what I did on my blog, mostly so I can reference it myself.
- Get the mysql packages from darwinsource, this is by far the easiest way to get mysql on your box. http://www.opensource.apple.com/darwinsource/Current/
- There you will find a binary package (I guess you could comiple from source also, but I’m doing the quickest route) MySQL-43.binaries.tar.gz, download it.
$tar zxvf MySQL-43.binaries.tar.gzand you are left with a folder, in that folder it has a readme with the command you need to run$sudo tar -xzvf MySQL-43.root.tar.gz -C /- Now you need to edit the download MySQLdb sources file _mysql.c (as per this ) and remove the following lines near the top of the file
#ifndef uint
#define uint unsigned int
#endif - Now with that file patched, you can run
$python setup.py buildfollowed by$sudo python setup.py install. I didn’t have to create a symlink to any .so or .o files as mentioned in some other posts, I think it may be because I used darwinsource package rather than the packages from dev.mysql.com