<?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>WebSight Design Blog &#187; mysql</title>
	<atom:link href="http://blog.websightdesign.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.websightdesign.com</link>
	<description>The Official Blog of WebSight Design, Inc.</description>
	<lastBuildDate>Thu, 02 Feb 2012 22:40:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>Configuring MySQL-Python on OSX Leopard</title>
		<link>http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/</link>
		<comments>http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 18:38:30 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-python]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/</guid>
		<description><![CDATA[At WebSight Design we try to remain technology-agnostic. (The right tool or language for the job.) Having said that, we are primarily a PHP shop. However, with the launch of the Google App Engine, we&#8217;ve been looking seriously at Python. In recent years, I have become a big fan of development frameworks so to aide [...]<p><a href="http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/">Configuring MySQL-Python on OSX Leopard</a> is a post from: WebSight Design, Inc. company blog. With headquarters in the San Francisco bay area, WebSight Design, Inc. has been providing world class web engineering, creative design and hosting solutions since 1995. <a href="http://Websightdesign.com">WebSight Design</a></p>
]]></description>
			<content:encoded><![CDATA[<p>At <a title="WebSight Design, Inc." href="http://www.websightdesign.com" target="_blank">WebSight Design</a> we try to remain technology-agnostic. (The right tool or language for the job.) Having said that, we are primarily a PHP shop. However, with the launch of the <a title="Google App Engine" href="http://code.google.com/appengine/" target="_blank">Google App Engine</a>, we&#8217;ve been looking seriously at Python. In recent years, I have become a big fan of development frameworks so to aide me in learning the ways of the snake, I have been using the <a title="Django" href="http://www.djangoproject.com" target="_blank">Django</a> framework.</p>
<p>Getting it all setup wasn&#8217;t difficult. The Django installation is very easy. I started to get errors when I was trying to get my models working when I ran</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">manage.py syncdb</div></div>
<p>. Come to find out that I needed the MySQL-Python library installed to work correctly on my OSX Leopard machine. Most everything that I illustrate below is to be executed from the command-line. So if you are not familiar with working in the Terminal app, this post is gonna suck for you. So here is what I did to get it working:</p>
<p>First, download MySQL for Python<br />
<a title="Sourceforge" href="http://sourceforge.net/projects/mysql-python" target="_blank"> http://sourceforge.net/projects/mysql-python</a><br />
for me it was MySQL-python-1.2.2.tar</p>
<p>Unpack it:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tar -xzf MySQL-python-1.2.2.tar</div></div>
<p>Change to the directory that is created:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd MySQL-python-1.2.2</div></div>
<p>Next, locate your &#8220;mysql_conf&#8221; file.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">locate mysql_conf</div></div>
<p>Copy the location of this file so you can use it in the next few steps.</p>
<p>Next, you need to edit the &#8220;site.cfg&#8221; file and add the path to your &#8220;mysql_conf&#8221; file.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql_config = &quot;YOUR_PATH_GOES_HERE&quot;</div></div>
<p>Also, (very important), change the line that reads:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">threadsafe = True</div></div>
<p>TO</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">threadsafe = False</div></div>
<p>Save and exit the file.</p>
<p>Now, compile and install the library:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">python setup.py build<br />
sudo python setup.py install</div></div>
<p>NOTE: You may need to run &#8220;python setup.py clean&#8221; if you previously tried to build and install the library.</p>
<p>Next is the *really* important part. After I kept getting errors trying to run the Python server I found the missing piece on the <a href="http://projectmouse.org/2013/InstallingDjangoforLeopardwithMySQLSupport">ProjectMouse.org</a> site.</p>
<p>The key is, you need to create a symbolic link in the location that Python is expecting to find MySQL. This should be a link to the MySQL library that your computer is setup to use.<br />
See here:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo mkdir /usr/local/mysql/lib/mysql/<br />
sudo ln -s /usr/local/mysql-5.0.41-osx10.4-i686/lib/libmysqlclient_r.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib</div></div>
<p>NOTE: &#8220;mysql-5.0.41-osx10.4-i686&#8243; is where MySQL is installed on my machine. Change this to the location specific to your computer.</p>
<p>Finally, import MySQLdb into Python and test your configuration:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">python<br />
import MySQLdb</div></div>
<p>NOTE: You should not see any errors or warnings. Hit &#8220;Ctrl+d&#8221; to exit the interepter.</p>
<p>Now go back and run</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">manage.py syncdb</div></div>
<p>again and you should not get any errors.</p>
<p><a href="http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/">Configuring MySQL-Python on OSX Leopard</a> is a post from: WebSight Design, Inc. company blog. With headquarters in the San Francisco bay area, WebSight Design, Inc. has been providing world class web engineering, creative design and hosting solutions since 1995. <a href="http://Websightdesign.com">WebSight Design</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.websightdesign.com/2008/04/27/configuring-mysql-python-on-osx-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

