It was more work than it should have been, but you can get access to a MySQL database from Python on OS X 10.5 by following the instructions at this blog post.
If you’re using Pydev in Eclipse, be sure /Library/Python/2.5/site-packages is in the System PYTHONPATH. Bring up the Preferences dialog, open Pydev in the tree, click on Interpreter – Python, click New Folder to the right of System PYTHONPATH, and then add the directory, if necessary.
Update 12/27/2009: With MySQL 5.1.41 and Snow Leopard (OS X 10.6), you no longer need to create the lib/mysql directory with symbolic links as described in the above article. Also, since Snow Leopard comes with Python 2.6, the path above for Eclipse should be
/Library/Python/2.6/site-packages. I found Geert’s instructions to be quite helpful for Snow Leopard. There’s also a lot of useful info here.
One problem I ran into is that I initially built the MySQL Python connector with a 32-bit version of MySQL 5.1 installed. After upgrading, I forgot to delete the build directory to force the connector to completely rebuild. When I then tried to run “import MySQLdb” in the interpreter, I got the cryptic message “ImportError: dynamic module does not define init function (init_mysql)”. If I had read all of the comments in that last article before figuring this out, I might have gotten a hint from the comment mentioning that not even “setup.py clean” would delete the build directory if you left off the 64-bit architecture flags.