Update: I made progress on this issue. See my newer post here.
If you’re interested in writing Python scripts on Windows which access MySQL databases, be sure you avoid Python 2.6.
The standard way to interact with a MySQL database via Python is to install the mysql-python package The problems arise because of several things.
- mysql-python still doesn’t have compiled binaries for 2.6
- Windows doesn’t ship with a C compiler.
- It’s a SOB to use any of the free C compilers to compile from source.
A couple of kind souls have provided their own compiled versions in this forum thread, but neither of the provided versions works on the two Windows machines I’ve tried them on.
I tried following the official directions to compile on windows using the “setup.py build”-method, but MinGW spits out several bajillion lines indicating the following(bolded part indicates error found over and over again):
C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\opt/mysqlclient.lib(./mysqlcli
ent.dir/relwithdebinfo/inftrees.obj):(.text[_inflate_table]+0x4e3): undefined re
ference to `@__security_check_cookie@4′
collect2: ld returned 1 exit status
error: command ‘gcc’ failed with exit status 1
There’s very little useful information to be found from a google search on this, so as it stands, I’m pretty much unable to use Python 2.6 + MySQL.
I really wonder why MySQL support isn’t packaged with Python. It’s not like accessing MySQL is an unheard of operation…