EnvironmentError: mysql_config not found

I am using Mac OS X 10.9, MAMP 1.9 (MySQL 5.1.44), Python 2.7.5.

Got this error when I change database configuration in settings.py.

I felt this issue can make me painful, so I start logging what happened and how I fixed.

Do not follow below steps. Just go straightly bottom of article and read last part.

Searched google and found a problem. According this article, it might be missing the MySQLdb module. So I need to install it. To install MySQLdb module, I found another article that explains how to install.

Step 1: Open shell and execute below

However, since I am using MAMP database, I had to set up differently as below:

Step 2: Execute below

However, I got the error as below:

According to this article, the error is causing by some Python compile issue.

So, execute below

And -mno-fused-madd error is gone; however, I faced another error (f**k)

OK, according to this article, MAMP’s version of MySQL does not contain the dev headers. Therefore, I should download headers and integrate with MAMP.

At this point, I planned to give up. However, I found this resource, which looks very relevant with this problem. (I couldn’t open original webpage; thus, the link is cached from Google)

New Step 1 Start: install XCode.

I already have XCode installed. Thus, skip this step.

Step 2: Install CMake

Open http://www.cmake.org/cmake/resources/software.html and download Mac OS X dmg file.

Install CMake.

Step 3: Stop MAMP completely


Step 4: Download MySQL header

Open http://sourceforge.net/projects/mamp/files/mamp/ and find your MAMP version.

In your MAMP version folder, you can find MAMP_components_{version}.dmg. In my case, MAMP_components_1.9.dmg

Once finish download, mount and find mysql-{version}.tar.gz in MAMP_src folder. And extract tar archive.

Run CMake with MySQL 5.1.44.

Then you will get this error.

Now, run below command and do following replace:

And find win/configure.data line, and comment out as below.

Then run below command

And I got other errors. Damn… Give up this solution.

Tried to find out another solution.

I followed below. Now don’t have energy to write steps. Just go to his article and follow the step.