views:

1194

answers:

2

Hi,

I'm trying to install MySQLDB for python on Cygwin. Unfortunately, when I run python setup.py build, I get the following error:

$ python setup.py build
/bin/sh: /usr/local/bin/mysql_config: No such file or directory
Traceback (most recent call last):
  File "setup.py", line 16, in <module>
    metadata, options = get_config()
  File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/home/Ben/python/MySQL-python-1.2.2/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError, "%s not found" % mysql_config.path
EnvironmentError: /usr/local/bin/mysql_config not found

Clearly I don't have mysql_config installed, which I guess is the problem. This is mentioned in the README for MySQLDB, but it doesn't explain how to either get around it or how to install mysql_config.

So maybe this is as easy as: How can I install mysql_config for Cygwin?

Or maybe it's harder than that.

FYI: I have python 2.5.2 and MySQL 5.1.30, running under Cygwin.

Thanks,

Ben

+1  A: 

You'll need mysql-devel, if it's available for cygwin, or you'll need to build mysql from source.

Your best bet is probably to just compile the MySQL client yourself in order to get the necessary headers to compile MySQLdb. See this note on the similar Perl DB driver.

Yoni Samlan
Thanks for that -- I'll give it a go!
Ben
A: 

I followed the directions on this comment to get MySQL installed on Cygwin. I had to use version 5.1.35, which can be downloaded from here, as the latest (5.1.41) failed to build.

Here is the command line I used:

./configure –without-libedit –without-readline –without-server CFLAGS=-O2`

tmitchell