<?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>OSX Hosting &#187; free</title>
	<atom:link href="http://osxhosting.com/osxhosting/tag/free/feed" rel="self" type="application/rss+xml" />
	<link>http://osxhosting.com/osxhosting</link>
	<description>Anything to do with hosting from mac OS X servers!</description>
	<lastBuildDate>Fri, 13 Aug 2010 17:21:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing MySQL on on Mac OS X</title>
		<link>http://osxhosting.com/osxhosting/installing-mysql-on-on-mac-os-x#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://osxhosting.com/osxhosting/installing-mysql-on-on-mac-os-x#comments</comments>
		<pubDate>Wed, 30 Jan 2008 18:04:28 +0000</pubDate>
		<dc:creator>montanaflynn</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://macosxhosting.wordpress.com/2008/01/30/installing-mysql-on-on-mac-os-x/</guid>
		<description><![CDATA[MySQL has become one of the most popular databases for Web applications. The database is well suited for common Web-related tasks like content management, and for implementing Web features like discussion boards and guestbooks. For a time, some developers avoided MySQL for commercial applications because it did not implement certain features, such as transactions. But [...]]]></description>
			<content:encoded><![CDATA[<h1><img src="http://developer.apple.com/internet/images/title_osdb.gif" alt="MySQL on Mac OS X" height="33" width="680" /></h1>
<p>MySQL has become one of the most popular databases for Web applications. The database is well suited for common Web-related tasks like content management, and for implementing Web features like discussion boards and guestbooks. For a time, some developers avoided MySQL for commercial applications because it did not implement certain features, such as transactions. But this is no longer the case, and MySQL is a great choice for just about any Web-based application.<span id="more-14"></span></p>
<p>In this article I’ll give you an overview of MySQL’s features and drawbacks, show you how to install MySQL on Mac OS X, and introduce you to some of MySQL’s notable technical aspects.</p>
<h2>MySQL Features</h2>
<p>Perhaps the most prominent feature of MySQL is its speed when running SQL SELECT statements. MySQL was built for speed. The core of the MySQL engine is very small and streamlined, and the default table type (a modified ISAM table) was designed specifically for running SELECTs quickly. If your application calls for the advantages of a relational structure but the database contents are relatively static — as is often the case with Web content — MySQL’s speed is a great advantage.</p>
<p>MySQL is also undeniably stable. In both your production and serving environments, you can be reasonably confident that MySQL will be up and processing queries as long as power flows to your machine.</p>
<p>Another important benefit is that MySQL is relatively easy to learn. Even if you’re new to relational databases, you can learn MySQL and create very sophisticated Web applications in a short period of time.</p>
<p>The popularity of MySQL is a benefit as well, because if you run into difficulty, you can lean on the active community that supports MySQL. There are many mailing lists dedicated to MySQL, and most questions find quick and thorough answers.</p>
<h2>MySQL Drawbacks</h2>
<p>If you are an advanced database user, you should be aware of some of MySQL’s limitations. MySQL’s implementation of standard query language is missing support for sub-selects, foreign key constraints (for some table types), stored procedures, and views. If you feel you need these features, you’re probably better off looking into PostgreSQL, FrontBase, or another database.</p>
<p>Lack of support for transactions <i>used</i> to be a drawback of MySQL, but this has been addressed. Now, on Mac OS X, you can use the MySQL InnoDB table type and have access to row-level locking and robust transaction support, as well as foreign key constraints.</p>
<h2>Installing MySQL</h2>
<p>If you’re running Mac OS X Server, you are in luck — MySQL is already there. Just go to Applications/Server/MySQL Manager to access it. If you are running Mac OS X Client, you’ll have to install MySQL. if you have already installed a version of MySQl and want to upgrade, I can recommend the <a href="http://www.entropy.ch/software/MacOSx/mysql/">upgrade instructions</a> from http://www.entropy.ch. For a new installation, follow the Mac OS X installation instructions for the MySQL provided binary distribution ( a true Mac OS X installer package file) at <a href="http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html">http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html</a> and be done with it. However, sometimes you want to compile and install directly from the source, either because you are changing the default build settings, or you want the latest and greatest version before there’s a binary installer. The following will help you through that process.</p>
<p>When installing MySQL, you need to be aware of the potential effect this will have on the security of your system, as a database server can open an avenue of attack. In the example below, I show how to install MySQL on Mac OS X while maintaining the security of your system.</p>
<p>One basic security tenet is that of “least 				privilege.” In short, this means that everyone and 				everything should have only the privileges required for 				it to complete its task(s). Those privileges should be 				available for the least amount of time possible—ideally, once the task is completed, the privileges 				should be revoked.</p>
<p>I’m also 				choosing to build MySQL from source, rather than install 				a pre-built binary. This gives greater control over the 				installation, as you’ll see below.</p>
<h2>Configuring and Compiling MySQL</h2>
<p>I plan to install mysql in <code>/usr/local/mysql</code>. I also plan to locate the mysql UNIX socket under the <code>/usr/local/mysql/</code> directory as <code>/usr/local/mysql/run/mysql_socket</code> so that it will be publicly available, but associated with the MySQL installation. Note that in a standard installation, the socket file would be placed in <code>/tmp</code>.</p>
<p>You can now <a href="http://www.mysql.com/downloads/">download the source</a> via a Web browser.</p>
<p>Once you have the source, you can pretty much follow the <a href="http://dev.mysql.com/doc/refman/5.0/en/quick-install.html">quick install directions</a> from the mysql documentation pages, adding only debug support (<code> — with-debug</code>) and the build environment comment (<code> — with-comment</code>). The <code>configure</code> command should look like:</p>
<pre>./configure --prefix=/usr/local/mysql
--with-unix-socket-path=/usr/local/mysql/run/mysql_socket
--with-mysqld-user=mysql --with-comment --with-debug</pre>
<p>Once the configuration completes, running <code>make</code>, and then <code>sudo make install</code>, installs mysql in <code>/usr/local/mysql</code>. Running <code>sudo /usr/local/mysql/bin/mysql_install_db --force</code> adds the <code>var/</code> space for databases and creates the default databases (mysql and test). You also need to add the <code>run/</code> directory where the mysql UNIX socket will live, with <code>sudo mkdir /usr/local/mysql/run</code>. Once all of that is done, a directory listing should look like:</p>
<pre>% ls -Fla /usr/local/mysql/
total 26
drwxr-xr-x 13 root wheel 1024 Jun 5 13:42 ./
drwxr-xr-x 11 root wheel 1024 Jun 5 12:19 ../
drwxr-xr-x  2 root wheel 1024 Jun 5 12:20 bin/
drwxr-xr-x  3 root wheel 1024 Jun 5 12:19 include/
drwxr-xr-x  2 root wheel 1024 Jun 5 12:19 info/
drwxr-xr-x  3 root wheel 1024 Jun 5 12:19 lib/
drwxr-xr-x  2 root wheel 1024 Jun 5 12:20 libexec/
drwxr-xr-x  3 root wheel 1024 Jun 5 12:20 man/
drwxr-xr-x  6 root wheel 1024 Jun 5 12:21 mysql-test/
drwxr-xr-x  2 root wheel 1024 Jun 5 13:42 run/
drwxr-xr-x  3 root wheel 1024 Jun 5 12:20 share/
drwxr-xr-x  7 root wheel 1024 Jun 5 12:21 sql-bench/
drwx------  4 root wheel 1024 Jun 5 13:37 var/</pre>
<p>Note that at this point everything is owned by root — meaning the mysql account won’t be able to write to the databases under <code>var/</code> nor be able to create the mysql UNIX socket in the <code>run/</code> directory. Since we want to run the MySQL database under the mysql account, and <b>not</b> under the root account, we need to change the group association of <code>/usr/local/mysql</code> to the group mysql, and the ownership of <code>/usr/local/mysql/run</code> and <code>/usr/local/mysql/var</code> to the mysql account, as follows:</p>
<pre>sudo chgrp -R mysql /usr/local/mysql
sudo chown -R mysql /usr/local/mysql/run /usr/local/mysql/var</pre>
<p>The directory listing now looks like:</p>
<pre>% ls -Fla /usr/local/mysql
total 26
drwxr-xr-x 13 root  mysql 1024 Jun 5 13:42 ./
drwxr-xr-x 11 root  wheel 1024 Jun 5 12:19 ../
drwxr-xr-x  2 root  mysql 1024 Jun 5 12:20 bin/
drwxr-xr-x  3 root  mysql 1024 Jun 5 12:19 include/
drwxr-xr-x  2 root  mysql 1024 Jun 5 12:19 info/
drwxr-xr-x  3 root  mysql 1024 Jun 5 12:19 lib/
drwxr-xr-x  2 root  mysql 1024 Jun 5 12:20 libexec/
drwxr-xr-x  3 root  mysql 1024 Jun 5 12:20 man/
drwxr-xr-x  6 root  mysql 1024 Jun 5 12:21 mysql-test/
drwxr-xr-x  2 mysql mysql 1024 Jun 5 13:42 run/
drwxr-xr-x  3 root  mysql 1024 Jun 5 12:20 share/
drwxr-xr-x  7 root  mysql 1024 Jun 5 12:21 sql-bench/
drwx------  4 mysql mysql 1024 Jun 5 13:37 var/</pre>
<p>You can now start mysql and perform a few important tasks, like setting a mysql password to protect the database itself. Note that, while starting the database requires system root privileges, actions within the database itself do not require system root privileges, but database root privileges. It is somewhat confusing that MySQL uses the account name “root” for its all-powerful account, just as the system does, even though they are completely separate entities.</p>
<p>Starting mysql is accomplished with:</p>
<pre>sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &amp;</pre>
<p>Now you can run through some of the basic tests — but first, go ahead and secure the database by adding a password for the database “root” user, as follows:</p>
<pre>/usr/local/mysql/bin/mysqladmin -u root password sniggle</pre>
<p>Here “sniggle” is the password you are assigning to the database root account. In MySQL, a single user is associated with a username and a host. Most often on your development machine you will be connecting to the database locally, so the host will be “localhost”. However, if you are attempting to connect from a different machine, you will have to assign permissions based on both username and hostname. For more information on users and passwords within MySQL, <a href="http://dev.mysql.com/doc/mysql/en/GRANT.html">read about</a> MySQL’s grant tables, and the <code>grant</code> and <code>revoke</code> statements.</p>
<h2>Conclusion</h2>
<p>MySQL is a great database for Web applications and a great complement to a Mac OS X development environment. Install it on your machine and create applications in Perl, PHP, JSP, or whatever languages you like best. To administer a MySQL installation on Mac OS X, you can look to popular tools such as the Web-based <a href="http://www.phpmyadmin.net/home_page/">phpMyAdmin</a> from <a href="http://www.phpwizard.net/">phpwizard.net</a>, or <a href="http://www.rtlabs.com/macsql/">MacSQL</a> from <a href="http://www.rtlabs.com/">Runtime Labs</a>.</p>
<p>For information about starting MySQL on startup, see <a href="http://www.osxfaq.com/Tutorials/LearningCenter/HowTo/Startup/index.ws">this article</a> from macosxfaq.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://osxhosting.com/osxhosting/installing-mysql-on-on-mac-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
