You'll probably want to improve the efficiency of your PHP application, at some point, by storing some data locally. It's likely that you'll use a database to perform this task. One of the more popular databases on the market is MySQL. It provides robust capability and the price is right. In addition, MySQL seems to enjoy better than average support from a cadre of developers who use it.
Like everything else in this chapter, MySQL is open source. Normally, you don't have to buy this product ”just download it. However, in some situations you do need to buy a license, such as when you create an application for commercial ( shrink-wrap ) distribution where you'll realize a profit from the sale of the application. Make sure you understand the distribution requirements for MySQL by reading them at http://www.mysql.com/downloads/index.html.
The example in this chapter relies on MySQL 4.0, the latest production version at the time of writing, which you can download at http://www.mysql.com/downloads/mysql-4.0.html. You'll notice that MySQL comes in quite a few versions for various platforms including Linux, Windows, Solaris, FreeBSD, Mac OS X, HP-UX, IBM AIX, Novell NetWare, SCO OpenUnix, SGI Irix, and DEC OSF. You can also download the source code and create your own flavor of MySQL if necessary. The test system for this chapter uses the compiled Windows version with default settings applied by the installer. If you use some other form of MySQL, your screen shots will vary from mine.
Once you download the version of the product you need, install it according to the vendor directions. In most cases, this means starting the installer or unpacking the product and performing a manual install. The Windows Installer version is very easy to use ”just double-click the executable that you download and follow the prompts.
Learning to use MySQL is relatively straightforward. You can find the complete product documentation at http://www.mysql.com/documentation/index.html. The documentation comes in two formats: PDF, for a printed version, or HLP, for a desktop electronic version. Part of the documentation is a tutorial that you'll find at http://www.mysql.com/doc/en/Tutorial.html. The vendor provides training and certification courses that you can learn about at http://www.mysql.com/training-and-certification.html. The Webmonkey site at http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html provides an excellent online MySQL tutorial. Another good tutorial appears on the TAASC site at http://www.analysisandsolutions.com/code/mybasic.htm. In fact, you can find a number of tutorials on this product. In addition, take a look at Mastering MySQL 4 by Ian Gilfillan (Sybex, 2003).