oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button Apache Web Serving With Mac OS X

Apache Web-Serving With Mac OS X, Part 5

by Kevin Hemenway

Editor's Note: Kevin returns with his fifth article concerning Apache, OS X, and the immense power available to the common man. Having established a good, firm pool of Apache knowledge in the first four articles, Kevin takes the time to focus on a popular supplementary technology, namely the database server MySQL.

Even after getting that prime parking spot, and even after getting one of those deficit-inducing, dotcom-deflating chairs, you stare down at the latest GatesMcFarlaneCo company email and realize that you've done a little too much enchanting. That jocular, mustached, stomach-clutching behemoth you call your boss is positively smitten with Mac OS X, and his eyes are round with the possibilities.

"Intrepid reader!" he writes, "Our lemming leaps into your waiting arms!" He's quoting from the GatesMcFarlaneCo Employee Handbook again, but he gets to the point rather quickly: "Listen, lots of people have been asking me about databases and this ess-queue-ell stuff. They figure, with OS X and your skill, it should be easy to set up, right? I told them we'd demonstrate something for 'em this afternoon. See you at 3!"

You glance down at your watch. It's 1:30. Your stomach grumbles. Back to your watch. Eyes on the monitor. "See you at 3!" The grumbles are louder. Watch. Monitor. Stomach. Keanu Reeves whispers, "You've got 3 seconds; what do you do? WHAT DO YOU DO?!"

Time for lunch!

Before we begin

In Part 5 of this series, we're going to look at installing MySQL as well as creating a simple PHP script that creates a database, adds some information, and then returns the data to the browser. Be aware that this article is not a tutorial for SQL or the intricacies of running MySQL--we focus on the installation on OS X only. If you need a brush up on SQL, check out O'Reilly's excellent aboutSQL series.

Inevitably, someone is going to ask, "Hey! Why'd you choose MySQL over PostgreSQL (another popular database server)?" This isn't a Quidditch match, folks; use whichever one suits you better. MySQL is more popular and easier to use, but PostgreSQL has more of the features that die-hard database users will say "make the man." If you're new to databases and SQL, stick with MySQL for a while. Once you're making the big bucks, go with PostgreSQL. Here we focus on MySQL, but the concepts apply equally to both.

Before we get to the article, we have one final concept to discuss:

Source code or double-clickable?

Related Reading

Apache: The Definitive Guide
Vital Information for Apache Programmers and Administrators
By Ben Laurie, Peter Laurie

We Mac users, I tell ya', we've had it easy for quite a while. Heck, even those Windows-type people have had a smooth ride through most of their years. See, when we want to install software, we double-click. We follow the prompts, and perhaps a reboot later, we've got our new software and we're ready to go.

There are breeds of computer users, however, that fall into a different category entirely. They delight in mucking about with makefiles, configure scripts, source code, and more. They like choosing esoteric options for which the only result is scant optimization that may or may not truly exist. They like watching screenfuls of information flash by, faster than they can read, and they revel in re-examining what they missed.

This is the world of "compiling source."

Rest assured, I'm not going to force you to do anything you don't want to do. Some of you have heard of this compiling junk, and it turns your stomach. You're thinking, "Wait, the Mac was easy! They added this old-fangled type-in-the-window thing, and now they want me to quack like a programmer?! Bollocks on you. I'm tellin' Mom!"

There are advantages to compiling from source: tailoring the installation to your work environment; turning on or off options that may otherwise be unused; and modifying code for those "special moments" that the original developer hadn't prepared for.

Most Linux-like systems, Mac OS X included, cater to both the user who wants to double-click and the user who wants to compile from source. OS X allows you to double-click a .pkg file; Red Hat grants you an .rpm file; and Debian has .deb files. All distributions allow you to compile from source, provided you have the right tools available. For OS X, this means you have the latest Developer Tools installed.

Below, I'm going to show you how to install MySQL. I'll show you where to get the double-clickable version, as well as how to build, from source, an exact copy. It's actually pretty easy and won't take you more than a few minutes (which is good, since your lunch break was rather loooonng). Let's get started.

Pages: 1, 2, 3

Next Pagearrow