sammcd.com

Mar 27 2008

Building Mysql-Python on Mac OS 10.5 Leopard

So, I have recently been learning a lot about django, and I use a mac.  This has been causing me a few problems.  The first of which is that the mysql-python download does not work on OS 10.5 Leopard out of the box.  These instructions are assuming that you installed MySQL using the MySQL Mac Binary.  Here are some instructions for installing python-mysql 1.22 os Leopard:

 1)  In the MySQL-python-1.2.2 directory open up site.cfg.  Uncomment the line with mysql_config on it and make it look like this:

mysql_config = /usr/local/mysql/bin/mysql_config

2) This will make the install go farther, but you will still get an error message, so you need to open up _mysql.c and delete these lines: 

 #ifndef uint 

#define uint unsigned int 

#endif 

 3) Run the build command by typing this: 

python setup.py build  

This will give you some warning messages, but ignore them. 

4) Run the install command by typing this in terminal: 

python setup.py install  

5) It is now installed, but if you use it, you will still get an error.  To fix it, run this terminal command: 

sudo mkdir /usr/local/mysql/lib/mysql 
sudo cp /usr/local/mysql/lib/libmysqlclient_r.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib  

Now you are ready to go. Special thanks to Michal Kox, and his post on the mysql forums.  Without this I would have never gotten this running. 

Comments (View)
blog comments powered by Disqus