<?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>matthewcarriere.com &#187; macports</title>
	<atom:link href="http://matthewcarriere.com/tag/macports/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthewcarriere.com</link>
	<description>a blog about startups, tech, and development.</description>
	<lastBuildDate>Sat, 12 May 2012 04:31:24 +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 MySQL on Mac OS X Leopard using MacPorts</title>
		<link>http://matthewcarriere.com/2008/04/02/installing-mysql-on-mac-os-x-leopard-using-macports/</link>
		<comments>http://matthewcarriere.com/2008/04/02/installing-mysql-on-mac-os-x-leopard-using-macports/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 06:05:49 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://matthewcarriere.com/?p=24</guid>
		<description><![CDATA[There comes a time in every Rails developers life that they need to work with MySQL. Often this means that your development comes to a screeching halt as you wade through the various options for getting MySQL installed on your Mac. This guide won&#8217;t help you install it anywhere else&#8230; because I am a zealot [...]]]></description>
			<content:encoded><![CDATA[<p>There comes a time in every Rails developers life that they need to work with MySQL. Often this means that your development comes to a screeching halt as you wade through the various options for getting MySQL installed on your Mac. </p>
<blockquote><p>This guide won&#8217;t help you install it anywhere else&#8230; because I am a zealot and I don&#8217;t care how to install it anywhere else.</p></blockquote>
<p>Install MySQL using macports, go get a coffee while this runs its course.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo port install mysql5 +<span style="color: #000066;">server</span></pre></td></tr></table></div>

<p>Next up, create the initial databases used by MySQL.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>lib<span style="color: #66cc66;">/</span>mysql5<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysql_install_db --<span style="color: #000066;">user</span>=mysql</pre></td></tr></table></div>

<p>Configure MySQL to start at system start up.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo launchctl load -w <span style="color: #66cc66;">/</span>Library<span style="color: #66cc66;">/</span>LaunchDaemons<span style="color: #66cc66;">/</span>org.macports.mysql5.plist</pre></td></tr></table></div>

<p>Start MySQL.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysqld_safe5 <span style="color: #66cc66;">&amp;</span></pre></td></tr></table></div>

<p>You can always stop the service manually as well:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">mysqladmin5 -u root -p shutdown</pre></td></tr></table></div>

<p>Confirm that that MySQL is running.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">mysqladmin5 -u root -p ping</pre></td></tr></table></div>

<p><em>Just hit enter at the password prompt, as it is blank. We are about to change that.</em></p>
<p>Secure your server.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">mysqladmin5 -u root password <span style="color: #66cc66;">&#91;</span>your password goes here<span style="color: #66cc66;">&#93;</span></pre></td></tr></table></div>

<p>At this point you should have your MySQL server up and running. However, your Rails project may complain about not being able to find the socket file. You can find that using the &#8216;status&#8217; command.</p>
<p>First log into MySQL.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">mysql5 -u root -p</pre></td></tr></table></div>

<p>At the prompt, run the command.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">status;</pre></td></tr></table></div>

<p>In the output you will see an entry listing the socket being used by MySQL. You can use this in the database.yml file.</p>
<p>And finally, I really don&#8217;t like typing that &#8217;5&#8242; after all the commands&#8230; I can&#8217;t explain it, it just upsets me. So I like to create a symbolic link for the mysql5 and mysqladmin5 commands.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo ln -s <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysql5 <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysql
sudo ln -s <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysqladmin5 <span style="color: #66cc66;">/</span>opt<span style="color: #66cc66;">/</span>local<span style="color: #66cc66;">/</span>bin<span style="color: #66cc66;">/</span>mysqladmin</pre></td></tr></table></div>

<p>That should get you coding again against a MySQL database!</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewcarriere.com/2008/04/02/installing-mysql-on-mac-os-x-leopard-using-macports/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

