<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MangoOrange™ &#187; 1.2.2</title>
	<atom:link href="http://www.mangoorange.com/tag/122/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mangoorange.com</link>
	<description>Web Hosting Reviews &#38; Mac WordPress Theme</description>
	<lastBuildDate>Wed, 25 Jan 2012 18:31:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing Python MySQLdb 1.2.2 on Mac OS X</title>
		<link>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/</link>
		<comments>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 16:59:37 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[1.2.2]]></category>
		<category><![CDATA[mac osx]]></category>
		<category><![CDATA[mysqldb]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=182</guid>
		<description><![CDATA[I started working on Python start of the year and I learned a lot while I'm doing my internship in my current company, MooWee Inc. So it's logical for me to try to pick up Django as the web framework. One of the hurdle I met and everyone else met is trying to install MySQL [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://farm2.static.flickr.com/1319/1129819772_77804dda7f.jpg" alt="Python" width="253" height="85" />I started working on <a title="Python" href="http://www.python.org" target="_blank">Python</a> start of the year and I learned a lot while I'm doing my internship in my current company, <a title="Moowee, Inc" href="http://moowee.tv/" target="_blank">MooWee Inc</a>. So it's logical for me to try to pick up <a title="Django Project" href="http://djangoproject.org" target="_blank">Django</a> as the web framework.</p>
<p>One of the hurdle I met and everyone else met is trying to install <a title="MySQL" href="http://www.mysql.org" target="_blank">MySQL</a> adapter for Python. Being the most popular database used, it is crucial to have it work rather than circumventing around the problem by using alternative database such as <a title="SQLite" href="http://www.sqlite.org" target="_blank">SQLite</a> or <a title="PostgreSQL" href="http://www.postgresql.org/" target="_blank">PostgreSQL</a>.</p>
<p>After a few hours of searching, I found a few references that somewhat not entirely complete. I did some cross referencing and found two brings me to the entire solutions, which I'm about to show below.</p>
<p><span id="more-182"></span></p>
<p><span style="text-decoration: underline;"><strong>Step 0:<br />
</strong></span>Before I start, I assumed that you have <a title="MySQL" href="http://mysql.org" target="_blank">MySQL</a> and <a title="Python" href="http://www.python.org" target="_blank">Python</a> installed on the mac.</p>
<p><span style="text-decoration: underline;"><strong>Step 1:</strong></span><br />
Download the latest <a title="MySQL for Python" href="http://sourceforge.net/project/showfiles.php?group_id=22307" target="_blank">MySQL for Python</a> adapter from SourceForge.</p>
<p><span style="text-decoration: underline;"><strong>Step 2:</strong></span><br />
Extract your downloaded package by typing</p>
<p><code>$ tar xzvf MySQL-python-1.2.2.tar.gz</code></p>
<p><strong><span style="text-decoration: underline;">Step 3:<br />
</span></strong>Inside the folder, clean the package by typing</p>
<p><code>$ sudo python setup.py clean</code></p>
<p><span style="text-decoration: underline;"><strong>Step 4:</strong></span><br />
In the same folder, edit _mysql.c using your favourite text-editor</p>
<p>4a. Remove the following lines (37-39):</p>
<p><code>#ifndef uint<br />
#define uint unsigned int<br />
#endif</code></p>
<p>4b. Change the following:</p>
<p><code>uint port = MYSQL_PORT;<br />
uint client_flag = 0;</code></p>
<p>to</p>
<p><code>unsigned int port = MYSQL_PORT;<br />
unsigned int client_flag = 0;</code></p>
<p><span style="text-decoration: underline;"><strong>Step 5:</strong></span><br />
Create a symbolic link under lib to point to a sub-directory called mysql. This is where it looks for during compilation.</p>
<p><code>$ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql</code></p>
<p><span style="text-decoration: underline;"><strong>Step 6:</strong></span><br />
Edit the setup_posix.py and change the following</p>
<p><code>mysql_config.path = "mysql_config"</code></p>
<p>to</p>
<p><code>mysql_config.path = "/usr/local/mysql/bin/mysql_config"</code></p>
<p><span style="text-decoration: underline;"><strong>Step 7:</strong></span><br />
In the same directory, rebuild your package (ignore the warnings that comes with it)</p>
<p><code>$ sudo python setup.py build</code></p>
<p><span style="text-decoration: underline;"><strong>Step 8:</strong></span><br />
Install the package and you are done.</p>
<p><code>$ sudo python setup.py install</code></p>
<p><span style="text-decoration: underline;"><strong>Step 9:</strong></span><br />
Test if it's working. It works if you can import MySQLdb.</p>
<p><code>$ python<br />
&gt;&gt;&gt; import MySQLdb</code></p>
<p>Voila.</p>
<p><span style="text-decoration: underline;"><strong>References:</strong></span><br />
<a title="n.code" href="http://dotnet.org.za/ncode/archive/2007/01/31/setting-up-mysql-for-python-mysqldb-on-mac-os-x-2.aspx" target="_blank">n.code</a><br />
<a title="Red Elephant" href="http://www.keningle.com/?p=11" target="_blank">RedElephant</a><br />
<a title="Django users Google Groups" href="http://groups.google.com/group/django-users/browse_thread/thread/b3e125adaf6e8356" target="_blank">Django users Google Groups</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

