[{TableOfContents }]


!!!How do I install MySQLdb?

Download from [sourceforge | http://www.sourceforge.net] and extract.

!Build

%%prettify 
{{{
$ python setup.py clean
$ python setup.py build
$ sudo python setup.py install
}}}
/%

!!!Mac OS X
You may have to edit {{setup_posix.py}} and change the line below (before building):

%%prettify 
{{{
mysql_config.path = "mysql_config"
}}}
/%

to  

%%prettify 
{{{
mysql_config.path = "/usr/local/mysql/bin/mysql_config"
}}}
/%

__Note__: you have to specify the path to your mysql_config unless you have installed mysql.com package for Mac.


!!Errors

!If you get this compile error

%%prettify 
{{{
/usr/include/sys/types.h:92: error: duplicate ‘unsigned’  
/usr/include/sys/types.h:92: error: two or more data types in declaration specifiers  
}}}
/%

edit the {{_mysql.c}} file and comment out this line

%%prettify 
{{{
#define uint unsigned int
}}}
/%

!Bitness

Make sure if you python is 32 bit, that your MySQL is 32 bit also.

!Using virtualenv

If you are installing MySQLdb in a {{virtualenv}} instance, it may be compiling against the system python, which may be 64-bit.  Read up on [Installing Python Packages].

!!! Sources

brainfault.com, etc

----
[Python | CategoryComputing.Lang.Python] - [Linux | CategoryComputing.Linux] - [MySQL | CategoryComputing.DB.SQL.MySQL]