<?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>superfancy &#187; mysql</title>
	<atom:link href="http://superfancy.net/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://superfancy.net</link>
	<description>version .02: slowly getting there</description>
	<lastBuildDate>Thu, 13 May 2010 05:22:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL Buddy: A MySQL admin utility</title>
		<link>http://superfancy.net/coding/sql-buddy-mysql-admin-utility/</link>
		<comments>http://superfancy.net/coding/sql-buddy-mysql-admin-utility/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 05:31:41 +0000</pubDate>
		<dc:creator>Stevie</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.steviebenge.com/?p=111</guid>
		<description><![CDATA[While browsing through my RSS feeds last week I came across a post over at WebResourcesDepot about this really slick MySQL admin utility called SQL Buddy. It&#8217;s written in PHP and Ajaxed to the max! And it&#8217;s free! Needless to say I downloaded and tested it out immediately.


SQL Buddy runs in a web browser just [...]]]></description>
			<content:encoded><![CDATA[<p>While browsing through my RSS feeds last week I came across a <a href="http://www.webresourcesdepot.com/ajaxed-mysql-admin-sql-buddy/">post</a> over at <a href="http://www.webresourcesdepot.com/">WebResourcesDepot</a> about this really slick MySQL admin utility called <a href="http://sqlbuddy.com/">SQL Buddy</a>. It&#8217;s written in PHP and Ajaxed to the max! And it&#8217;s free! Needless to say I downloaded and tested it out immediately.</p>
<p><span id="more-111"></span></p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-11.png" alt="SQL Buddy Screenshot" title="SQL Buddy Screenshot" width="500" height="375" class="alignnone size-full wp-image-112" /></p>
<p><a href="http://sqlbuddy.com/">SQL Buddy</a> runs in a web browser just like any other PHP app which is pretty cool. All you have to do is download the files, upload them to your webserver, and you&#8217;re off and running with pretty much zero configuration. And it&#8217;s even compatible with your browsers back and forward buttons!</p>
<p>It&#8217;s capable of just about everything that <a href="http://dev.mysql.com/downloads/gui-tools/5.0.html">MySQL Administrator</a> can do. I&#8217;ve been enjoying its ease-of-use. Definitely a pleasant way to take care of everyday MySQL admin tasks. It&#8217;s certainly not as powerful as something like <a href="http://mysql.navicat.com/mac_detail.html">Navicat</a> but admirably does a handful of things well. Take it for a test drive.</p>
]]></content:encoded>
			<wfw:commentRss>http://superfancy.net/coding/sql-buddy-mysql-admin-utility/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MySQL Administrator on Mac OSX Leopard: A Few Tips and Tricks</title>
		<link>http://superfancy.net/coding/mysql-administrator-on-mac-osx-leopard-tips-and-tricks/</link>
		<comments>http://superfancy.net/coding/mysql-administrator-on-mac-osx-leopard-tips-and-tricks/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 05:52:44 +0000</pubDate>
		<dc:creator>Stevie</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.steviebenge.com/?p=80</guid>
		<description><![CDATA[I mentioned in my previous article I&#8217;d show a couple of MySQL Administrator tricks so here goes. Many programmers like to use Terminal to do all MySQL administration tasks. It&#8217;s a great skill to have and one that can be picked up pretty easily and quickly when you get comfortable working with MySQL. I prefer [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned in my previous <a href="http://www.steviebenge.com/coding/php-mysql-apache-in-mac-osx-leopard/">article</a> I&#8217;d show a couple of MySQL Administrator tricks so here goes. Many programmers like to use Terminal to do all MySQL administration tasks. It&#8217;s a great skill to have and one that can be picked up pretty easily and quickly when you get comfortable working with MySQL. I prefer to do everything visually so I can actually see what I&#8217;m doing. There&#8217;s no right or wrong way but a lot of advanced tasks require work in the Terminal. However GUI tools are perfect for everyday administration tasks.</p>
<p><span id="more-80"></span></p>
<h2>Getting started in MySQL Administrator</h2>
<p>I presume if you followed my previous article you downloaded the <a href="http://dev.mysql.com/downloads/gui-tools/5.0.html">MySQL GUI Tools</a>, if not go ahead and download and install them. When you first open MySQL Administrator you&#8217;ll get a login screen:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/mysqladminlogin.png" alt="MySQL Admin Login" title="MySQL Admin Login" width="418" height="288" class="alignnone size-full wp-image-81" /></p>
<p>Where the button says &#8220;Skip&#8221; above it&#8217;ll say &#8220;Connect&#8221; for you&#8230; for some reason while taking screen shots it changed to &#8220;Skip.&#8221; Weird&#8230;</p>
<p>Working on the assumption that this is a fresh install of MySQL, you have not created a password for the &#8220;root&#8221; user. This is not a problem as you can easily do this after logging in to MySQL Adminstrator. Let&#8217;s not forget to tell MySQL Admininstrator where <code>mysql.sock</code> is located&#8230; expand &#8220;More Options&#8221; and put <code>/var/mysql/mysql.sock</code> in the box next to &#8220;Connect Using Socket.&#8221; So now the login screen should look like this:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/mysqladmin2.png" alt="MySQL Admin Screen" title="MySQL Admin Screen" width="415" height="371" class="alignnone size-full wp-image-82" /></p>
<p>Go ahead and hit &#8220;Connect&#8221; and you&#8217;re in:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/mysqladmininfo.png" alt="MySQL Admin Info" title="MySQL Admin Info" width="500" height="473" class="alignnone size-full wp-image-85" /></p>
<p>If you take a look at the icon&#8217;s up top you can begin to get an idea of what you can do with MySQL Administrator. You can run backups, monitor MySQL connections, view logs, create new databases and users, and a host of other things. Lets start off by assigning a password to &#8220;root&#8221; user. A little disclaimer&#8230; keep in mind that this is MySQL&#8217;s superuser of sorts and some people do not assign &#8220;root&#8221; a password. So with that out of the way, click on &#8220;Accounts&#8221; and highlight &#8220;root.&#8221; As you&#8217;ll see all you have to do is type a password in the box, then confirm it in the next box, then click &#8220;Save Changes:&#8221; </p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-41.png" alt="" title="MySQL Admin Accounts" width="500" height="395" class="alignnone size-full wp-image-87" /></p>
<h2>Adding a new MySQL user</h2>
<p>Since we&#8217;re already in the &#8220;Accounts&#8221; tab, lets go ahead and create a new MySQL user. All you need to do is press the &#8220;Add New User&#8221; button which is the first button in the bottom left corner:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-21.png" alt="Add New User" title="Add New User" width="334" height="117" class="alignnone size-full wp-image-88" /></p>
<p>So just type in the Login Information and press &#8220;Save Changes:&#8221;</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-1.png" alt="Login Info" title="Login Info" width="500" height="126" class="alignnone size-full wp-image-90" /></p>
<h2>Creating a new database</h2>
<p>So let&#8217;s move on and create a new database. Click on &#8220;Catalogs&#8221; and then the &#8220;Add&#8221; (aka +) symbol in the bottom left corner:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-31.png" alt="Add New Database" title="Add New Database" width="500" height="491" class="alignnone size-full wp-image-91" /></p>
<p>Name your new Schema (aka database) and press &#8220;Ok.&#8221; This creates an empty database ready for your next web application! I have a local installation of <a href="http://wordpress.org">WordPress</a> on my MacBook Pro so here is what that &#8220;Schema&#8221; looks like:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-42.png" alt="" title="Wordpress DB" width="499" height="396" class="alignnone size-full wp-image-92" /></p>
<p>So cool! Now we need to go back and assign privileges to the user we created in the previous step so the database can be accessed in an app.</p>
<h2>Assigning privileges to a user</h2>
<p>So go back to the &#8220;Accounts&#8221; panel, expand the user you previously created, and click on &#8220;Schema Privileges.&#8221; Directly underneath the User are a list of &#8220;hosts.&#8221; Since we&#8217;re just working locally, we&#8217;ll assign privileges to &#8220;localhost.&#8221; But feel free to add privileges to the other &#8220;hosts&#8221; for this user. This is probably the most confusing task you&#8217;ll do with MySQL Administrator so pay close attention. Highlight &#8220;localhost&#8221; and the &#8220;schema&#8221; you want to add user privileges to:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-5.png" alt="Schema Privileges" title="Schema Privileges" width="500" height="397" class="alignnone size-full wp-image-96" /></p>
<p>Now you need to select all (shift + click) the privileges you want to grant under &#8220;Available Privileges.&#8221; I just went ahead and gave myself all available privileges:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-61.png" alt="Available Privileges" title="Available Privileges" width="499" height="395" class="alignnone size-full wp-image-97" /></p>
<p>Next you&#8217;ll need to click the &#8220;Grant&#8221; button which is the one that has the &#8220;less than&#8221; character <code>&lt;</code>. Now the privileges you assigned will be in the &#8220;Assigned Privileges&#8221; column:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-71.png" alt="Assigned Privileges" title="Assigned Privileges" width="500" height="394" class="alignnone size-full wp-image-99" /></p>
<p>This was a head scratcher for me when I first started using MySQL Administrator. If you ever run into any difficulties just hover over the area you have questions about and usually a tool tip will appear. Now your database is ready to tag team with PHP in your web app of choice!</p>
<p>Well this should get you off and running with MySQL Administrator. I really only scratched the surface of things that can be done. Just click around and check stuff out&#8230; that&#8217;s pretty much how I learned. Have fun&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://superfancy.net/coding/mysql-administrator-on-mac-osx-leopard-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Setting up PHP, MySQL, and Apache in Mac OSX Leopard</title>
		<link>http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/</link>
		<comments>http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 05:23:22 +0000</pubDate>
		<dc:creator>Stevie</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.steviebenge.com/?p=33</guid>
		<description><![CDATA[One of the best features for web developers in Mac OSX Leopard is the inclusion of PHP and Apache. By default both are inactive and require you to get them ready for business. I will outline how to do this as well as get MySQL up and running so you can have a local development [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best features for web developers in <a href="http://www.apple.com/macosx/">Mac OSX Leopard</a> is the inclusion of <a href="http://www.php.net/">PHP</a> and <a href="http://www.apache.org/">Apache</a>. By default both are inactive and require you to get them ready for business. I will outline how to do this as well as get <a href="http://www.mysql.com/">MySQL</a> up and running so you can have a local development setup right on your Mac!</p>
<p>It&#8217;s all pretty easy to do but requires a little attention to detail in parts. So lets get started.</p>
<p><span id="more-33"></span><br />
Most of the files we&#8217;ll be working with are actually hidden from Finder. If you use a text editor like <a href="http://www.panic.com/coda/">Coda</a>, <a href="http://www.barebones.com/">BBedit</a>, <a href="http://www.barebones.com/products/textwrangler/">Text Wrangler</a>, or <a href="http://macromates.com/">TextMate</a> you can choose to have hidden files &#8220;shown&#8221; so you can find them in your file structure. I personally use Coda so all that you have to do is click on the &#8220;View&#8221; menu and choose Show Invisible Files, as illustrated below:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-2.png" alt="Coda: Show invisible Files" title="Coda: Show invisible Files" width="500" height="371" class="size-full wp-image-34" /></p>
<p>You can also run this simple Terminal command to &#8220;show&#8221; all hidden folders in Finder:</p>
<p><code>defaults write com.apple.finder AppleShowAllFiles TRUE</code></p>
<p>Then restart Finder by typing the following:</p>
<p><code>killall Finder</code></p>
<p>You should now be able to see all hidden files. </p>
<h2>PHP</h2>
<p>To enable PHP browse to Apache&#8217;s <code>http.conf</code> file located in <code>/etc/apache2/httpd.conf</code></p>
<p>Find this line:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#LoadModule php5_module libexec/apache2/libphp5.so</pre></div></div>

<p>All you need to do is uncomment the line by removing the hash <code>#</code> symbol.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule php5_module libexec/apache2/libphp5.so</pre></div></div>

<p>Now save <code>http.conf</code>. Don&#8217;t be alarmed if it asks for your system password&#8230; this is normal.</p>
<p>PHP 5.2.6 is the version shipped with Leopard. All the most popular extensions are already activated so you should be good to go. However if you need some of PHP&#8217;s extended features you may want to consider rebuilding PHP from source code as I&#8217;ve read the version that ships with Leopard has been problematic for some. I&#8217;ve never had any problems myself but it&#8217;s something to look out for. All relevant PHP settings are in the <code>php.ini</code> file. I won&#8217;t be covering any tweaks to that file in this article but you should be aware that it exists. By default, Leopard has an empty configuration file but provides a file which can be used as a template. From a new terminal window, type:</p>
<p><code>sudo cp /etc/php.ini.default /etc/php.ini</code></p>
<p>This creates your <code>php.ini</code> file, which is located in <code>/etc/php.ini</code> for your future reference.</p>
<p>You&#8217;ve now enabled PHP so lets move on to Apache.</p>
<h2>Apache</h2>
<p>Our friends at Apple were kind enough to ship a very modern version of Apache 2.2.6 for our development work. Kudos! To start up Apache click on the &#8220;Sharing&#8221; preference pane in System Preferences and enable &#8220;Web Sharing&#8221; like so:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-3.png" alt="Enable Web Sharing" title="Web Sharing" width="500" height="317" class="size-full wp-image-40" /></p>
<p>You can also use the following command the start Apache from Terminal:</p>
<p><code>sudo apachectl start</code></p>
<p>You&#8217;ll be prompted for your system password. Type it in and press enter.</p>
<p>If you need to restart Apache, this will do the trick:</p>
<p><code>sudo apachectl restart</code></p>
<p>Keep in mind any editing you do to the <code>http.conf</code> or to the <code>php.ini</code> will require a restart of Apache. You can use the above command or simply restart &#8220;Web Sharing&#8221; in System Preferences&#8230; it&#8217;s up to you.</p>
<h2>Testing PHP</h2>
<p>So now hopefully if everything has gone according to plan, we&#8217;ll see some fruits of our labor. Go back to the &#8220;Sharing&#8221; Preference Pane in System Preferences and click on the URL/ IP Address below &#8220;Your computer&#8217;s website.&#8221; If all goes well you&#8217;ll see a page that says &#8220;Test Page for Apache Installation.&#8221; You can also type <a href="http://localhost/">http://localhost/</a> in your browser which will take you to the same place. </p>
<p>Now in your text editor create a PHP file and type the following code:</p>
<p><code>&lt;?php phpinfo(); ?&gt;</code></p>
<p>Save it in <code>/Library/WebServer/Documents/</code> (start from the top level directory of your hard drive, not the Library directory in your home directory) with the name <code>test.php</code>.<br />
Now type <a href="http://localhost/test.php">http://localhost/test.php</a> in your browser and you should see something like this:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-4.png" alt="PHP Info" title="PHP Info" width="500" height="329" class="size-full wp-image-46" /></p>
<p>Great success!</p>
<h2>Setting up a personal website and virtual hosting</h2>
<p>If you&#8217;re the curious type and tried to click on &#8220;Your personal website&#8221; in the Web Sharing panel you may have noticed that you were greeted with a &#8220;Forbidden&#8221; message. So lets go ahead and set it up so you can serve up files from your &#8220;Sites&#8221; folder. Open up your text editor and create a file named after your &#8220;Home&#8221; folder. In my case it would be <code>StevieBenge.conf</code>. This file will live in <code>/etc/apache2/users/</code>. You&#8217;ll need to replace <code>StevieBenge</code> with the name of your &#8220;Home&#8221; directory. I&#8217;ve heard reports that this file is created automatically on new installs of Leopard but I had to create mine manually. Add the following code to the <code>.conf</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;directory &quot;/Users/StevieBenge/Sites/*/&quot;&gt;
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/directory&gt;</pre></div></div>

<p>Like above, replace <code>StevieBenge</code> with the name of your “Home” directory. Save the file. This will allow Apache to serve files out of your &#8220;Sites&#8221; folder. Sweet! You&#8217;ll also need to restart Apache for this to take effect.</p>
<p>Moving right along, lets set up Apache for virtual hosts. Virtual hosts are essential if you want to serve multiple websites from your &#8220;Sites&#8221; folder. You can choose pretty much any &#8220;domain&#8221; name you want or mirror any production sites you have hosted on a live server. I like to name all of my local development sites with the extension <code>.dev</code> to keep easy track of things. Getting virtual hosts to work in Leopard was a huge stumbling block for me because of a lot of misinformation I read around the internet. I was was really happy to finally get this working. And as you&#8217;ll see it&#8217;s pretty straightforward.</p>
<p>So to get started, browse to <code>/etc/hosts</code> and add the following to the end of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># Local aliases
127.0.0.1 steviebenge.dev</pre></div></div>

<p>Remember to change <code>steviebenge.dev</code> to the name of a site in your &#8220;Sites&#8221; folder. <code>127.0.0.1</code> is an IP Address that tells your Mac that your site is hosted locally. The site will only be accessible on your Mac. Now we&#8217;ll need to reopen the<code>.conf</code> file we created earlier in <code>/etc/apache2/users/</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;directory &quot;/Users/StevieBenge/Sites/*/&quot;&gt;
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/directory&gt;
&nbsp;
NameVirtualHost *:80
&nbsp;
&lt;virtualhost *:80&gt;
    DocumentRoot /Users/StevieBenge/Sites/steviebenge.dev
    ServerName steviebenge.dev
&lt;/virtualhost&gt;</pre></div></div>

<p>Again make sure to change the directory structure above to reflect your &#8220;Home&#8221; folder and the folder within your &#8220;Sites&#8221; folder you want to serve files out of. Restart Apache for the changes to take effect. So to test it out and make sure everything&#8217;s working properly, go ahead and move the <code>test.php</code> created earlier into your new directory in your &#8220;Sites&#8221; folder. If it&#8217;s successful you&#8217;ll again see:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-4.png" alt="PHP Info" title="PHP Info" width="500" height="329" class="size-full wp-image-46" /></p>
<p>Too add more virtual hosts run through the above steps again. Simple as that!</p>
<h2>MySQL</h2>
<p>Now here is where the fun begins. It&#8217;s odd that Apple didn&#8217;t include MySQL with Leopard as it&#8217;s pretty much synonymous with PHP. Anyway, you have a couple options for installing MySQL on Leopard. You can roll your own and compile and install from source code or use MySQL&#8217;s package installer for Leopard. I won&#8217;t discuss how to compile MySQL here but I did find an excellent tutorial on how to do this over at Dan Benjamin&#8217;s <a href="http://hivelogic.com/articles/2007/11/installing-mysql-on-mac-os-x">Hivelogic</a> site. I came pretty close to giving this a shot but I opted for the MySQL package installer. Dan brings up many salient points on why it&#8217;s beneficial to compile your own install in his tutorial, so I&#8217;d highly recommend checking it out. </p>
<p>So head over to the <a href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg">MySQL</a> downloads page and grab a copy of the Mac OS X 10.5 (x86) installer (currently 5.0.67). You can also optionally download the <a href="http://dev.mysql.com/downloads/gui-tools/5.0.html">MySQL GUI Tools</a>, which I would recommend as that is how I prefer to administrate MySQL. The Mac Installer is labeled MAC OSX 10.4 (Universal binaries) but, in my experience, it will work without issue on Leopard.</p>
<p>Install MySQL and the GUI Tools. There&#8217;s also a Preference Pane that you can install that allows MySQL to be stopped and started from System Preferences. Go ahead and install that as well.</p>
<p>After you install the MySQL Preference Pane, find it in System Preferences and start MySQL like so:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-6.png" alt="MySQL Preference Pane" title="MySQL Preference Pane" width="500" height="218" class="size-full wp-image-63" /></p>
<p>If you prefer starting MySQL from Terminal, you can do so with this command:</p>
<p><code>sudo /usr/local/mysql/support-files/mysql.server start</code></p>
<p>And you can use this command to stop MySQL:</p>
<p><code>sudo /usr/local/mysql/support-files/mysql.server stop</code></p>
<p>Now we&#8217;ll need to put the <code>mysql.sock</code> in the proper directory so MySQL can communicate with PHP.</p>
<h2>Getting MySQL and PHP to communicate</h2>
<p>The default location of <code>mysql.sock</code> is in the <code>/tmp/mysql.sock</code> directory. We&#8217;ll need to change this to <code>/var/mysql/mysql.sock</code> as this is where PHP will look for it.<br />
So first off, create a <code>my.conf</code> (or in this case <code>my.cnf</code>) file in your text editor and save it as <code>my.cnf</code> in the <code>/etc</code> folder with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[client]
socket = /var/mysql/mysql.sock
&nbsp;
[mysqld]
socket = /var/mysql/mysql.sock</pre></div></div>

<p>Next move <code>mysql.sock</code> to it&#8217;s new directory by typing the following code in a Terminal window:</p>
<p><code>sudo mkdir /var/mysql</code><br />
<code>sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock</code></p>
<p>Believe it or not, that&#8217;s pretty much it. One thing to keep in mind is the MySQL GUI Tools will still look for the <code>mysql.sock</code> in the old location so when you log in to MySQL Administrator enter <code>/var/mysql/mysql.sock</code> in the &#8220;Connect Using Socket&#8221; box under More Options:</p>
<p><img src="http://www.steviebenge.com/wp-content/uploads/2008/08/picture-7.png" alt="MySQL Administrator" title="MySQL Administrator" width="419" height="354" class="size-full wp-image-65" /></p>
<p>Now you&#8217;re ready to create your first MySQL Database. The MySQL Administrator makes this really easy, which I will cover in a future article. You can also administer your MySQL databases from Terminal. As I stated earlier, I prefer the GUI Tools but learning how to do things from Terminal is a useful skill to have. It&#8217;s totally up to you.</p>
<h2>Bonus Information</h2>
<p>I&#8217;ve read that you can also deal with the <code>mysql.sock</code> issue by editing the <code>mysql.default_socket =</code> line in your <code>php.ini</code> file to reflect the location of <code>mysql.sock</code>. I chose not to do this, but it may work for others</p>
<p>You may want to to change <code>php.ini</code> to report all PHP errors while you are in development. This can be done locating the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">error_reporting = E_ALL &amp; ~E_NOTICE</pre></div></div>

<p>And changing it to:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">error_reporting = E_ALL</pre></div></div>

<p>This is fine in your local development setup but of course not advised for a production server.</p>
<p>At the beginning of this article I illustrated how to &#8220;show&#8221; hidden files in Finder. Here&#8217;s that Terminal command again:</p>
<p><code>defaults write com.apple.finder AppleShowAllFiles TRUE</code><br />
<code>killall Finder</code></p>
<p>You can also &#8220;hide&#8221; those same hidden files with this command:</p>
<p><code>defaults write com.apple.finder AppleShowAllFiles FALSE</code><br />
<code>killall Finder</code></p>
<p>Another great resource for an all-in-one development setup is <a href="http://www.mamp.info/en/index.php">MAMP</a>. Using MAMP negates the need to do any of the above tweaking as it has its own versions of Apache, PHP, and MySQL. It&#8217;s perfect for those that want to get up and running quickly with a minimum of fuss.</p>
<h2>Conclusion</h2>
<p>Well this should get you started with PHP, MySQL, and Apache in Mac OSX Leopard. My inspiration for writing this article was to combine a lot of the information I read from other sites while getting my MacBook Pro set up. Many of the articles I came across were written around the time Leopard was released last Fall so some of the information was a bit out of date. Not that any of the above methods are terribly original on my part, but I&#8217;d like to credit some of the sources that helped me:</p>
<p><a href="http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/">procata.com</a>: This was the best resource I found and well worth checking out as it shows you how to install the <a href="http://pear.php.net/">PEAR</a> extension. Has some great tips that I didn&#8217;t cover here.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html">Installing MySQL on Mac OS X</a>: MySQL&#8217;s own how-to guide.</p>
<p><a href="http://adactio.com/journal/1395">adactio.com</a>: Jeremy Keith&#8217;s guide.</p>
<p><a href="http://foundationphp.com/tutorials/php_leopard.php">foundationphp.com</a>: Excellent screen shots with this PHP and Apache tutorial.</p>
<p>Thanks for reading and check back as I&#8217;ll be writing more articles about working with PHP, MySQL, and Apache. Feel free to keep the discussion going in the Comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/feed/</wfw:commentRss>
		<slash:comments>78</slash:comments>
		</item>
	</channel>
</rss>
