Skip to content

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.

  1. 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/
  2. 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.
  3. $tar zxvf MySQL-43.binaries.tar.gz and 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 /
  4. 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
  5. Now with that file patched, you can run $python setup.py build followed 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

Post a Comment

Your email is never published nor shared. Required fields are marked *