Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596002114/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Preface
Programmers have always put together software on their own time to"scratch their own itches." Untilthe 1990s, however, programmers lacked distribution mediums for massmarketing their creations. The Internet changed that and gave life tograss-roots software distribution philosophies that have challengedthose of the software giants. These philosophies include the FreeSoftware and Open Software movements.
Though significant differences cause endless debate between the FreeSoftware and Open Software camps, they share a core belief in thefreedom to access and modify the source code of any legally licensedsoftware. Though neither philosophy revolves directly around price,both have had the ultimate effect of reducing the cost of sometraditionally high-cost software. The most famous example of thiseffect is, of course, the Linux operating system.
Database software has always been notoriously overpriced. The entirefortune of Oracle is largely founded on a single producttheOracle database engine. Consequently, only large corporations havehad the financial resources to leverage the power of relationaldatabases. While database vendors struggled with how to license theirsoftware on the Internet, however, several groups of people were busydeveloping free and low-cost database solutions based on Free andOpen Software philosophies. Our focus is one of these databases:MySQL.
MySQL is powerful and flexible, while at the same time lightweightand efficient. It packs a large feature set into a very small, fastengine. While it does not have anywhere near the full feature set ofexpensive corporate databases, it easily offers enough to meet theneeds of mid-range database management.
Audience
This book is primarily for two classes of readers. The most obviousis the reader interested in using MySQL from either a databaseadministration perspective or from a database programmer perspective.In addition, anyone who wants to learn about relational databaseadministration and programming without paying out the nose for alicense from one of the big guys will find MySQL an excellentstarting point.
From a database administrator's perspective, wecover the basic methods of creating and managing databases and tablesin MySQL. We go beyond the simple tasks and provide performancetuning and troubleshooting tips to help you make sure your MySQLapplications are running at their best. We assume no prior knowledgeof SQL or relational databases.
Database programmers will find that we have covered all the majorprogramming interfaces from the most popular client/server and webprogramming languages. When we cover the interface for a particularlanguage, we assume the reader has a basic grasp of the language inquestion. For example, in theJava chapter, we assumethe reader knows how to write basic Java applications, and we showhow to make those Java applications talk to MySQL databases.
The immense popularity of MySQL on the Web has made it natural toprovide a focus on CGI programming with Managing and UsingMySQL . Web developers should therefore find this bookuseful in describing how to drive their web sites with a MySQLdatabase. For these chapters, very little CGI knowledge is needed,but we still assume that the reader is familiar with the basics ofthe programming language in question.
Purpose
At first glance, the purpose of this book seems obvious: MySQL is oneof the most popular open source applications of all time. One of thebiggest complaints about open source projects is the lack ofcomprehensive and comprehensible documentation. In the case of MySQL,however, lack of online documentation is rarely a problem.
MySQL has a wonderfully complete and free online reference manualavailable from the web site, at http://www.mysql.com. This manual covers thefull MySQL SQL syntax, installation, and its C API, as well asdatabase administration and performance tuning.
To make matters even more complex, MySQL is a moving target becauseof rapid development. In fact, "movingtarget" is a euphemism. Thanks mainly to the effortsof Michael "Monty" Widenius, MySQLis moving about as fast as an SST. So be prepared; you may find thatsome of the information in this book is either ahead of olderversions or behind newer versions.
Using This Book
We have divided this book into four sections. , we provide a reference section as a resourcefor quickly looking up APIs we cover in the first three sections.
if you are an experienced MySQL user orsimply skim it if you have experience with other database engines.
The job of the database administrator is to make certain that thedatabase is up and running efficiently and supporting itsapplications. If this is your job, isfor you. We cover security, performance tuning, and database design.Proper database design is essential for database architects if thegoal is to build database applications flexible enough to scale astheir needs change. You also need a proper database design if youwant your database to actually perform well.
is aimed at database architects andprogrammers. It contains chapters devoted to programming in specificlanguages or using specific tools. Of particular interest to webprogrammers will be the chapters on Perl, Java, Python, and PHP.
The book closes with a reference section covering elements of MySQLand some APIs.
Conventions Used in This Book
The following conventions are used in this book:
Constant width
Used to indicate anything that might appear in a program, includingkeywords, function names, SQL commands, and variable names. This fontis also used for code examples, output displayed by commands, andsystem configuration files.
Constant width bold
Used to indicate user input.
Constant width italic
Used to indicate an element (e.g., a filename or variable) that yousupply.
ItalicUsed to indicate directory names, filenames, program names, Unixcommands, and URLs. This font is also used to introduce new terms andfor emphasis.
Note
This icon is used to indicate a tip, suggestion, or general note.
Warning
This icon is used to indicate a warning.
Comments and Questions
Please address comments and questions concerning this book to thepublisher:
O'Reilly & Associates, Inc. |