Part I. Introduction
Module 1: Introduction
Why Is MySQL So Popular?
Elements of MySQL and Its Environment
MySQL Software Covered in This Book
The Book’s Web Site
Module 2: Installing MySQL
Installation Choices and Platforms
Using the Command-Line Interface
Using a Text Editor
Following the Instructions in This Book
Downloading and Verifying Files from the MySQL AB Web Site
Installing Under Linux
Installing Under Windows
Installing Under Mac OS X
Using a MySQL Installation Provided by an ISP
Upgrading an Existing MySQL Serve
Configuring Access to the MySQL Server
What If Things Don’t Work?
The Contents of the MySQL Directory
Configuring and Controlling the Apache Web Server
Setting up Perl
Resources
Module 3: Using the MySQL Monitor
Starting the Monitor
Style, Case, and Semicolons
The Monitor Help
Running the Monitor in Batch Mode
Loading the Sample Databases
MySQL Monitor Program Option
Graphical Clients
Part II. Using MySQL
Module 4: Modeling and Designing Databases
How Not to Develop a Database
The Database Design Process
The Entity Relationship Model
Entity Relationship Modeling Examples
Using the Entity Relationship Model
Using Tools for Database Design
Resources
Module 5: Basic SQL
Using the Music Database
The SELECT Statement and Basic Querying Techniques
The INSERT Statement
The DELETE Statement
The UPDATE Statement
Exploring Databases and Tables with SHOW and mysqlshow
Module 6: Working with Database Structures
Creating and Using Databases
Creating Tables
The Sample Music Database
Altering Structures
Deleting Structures
Module 7: Advanced Querying
Aliases
Aggregating Data
Advanced Joins
Nested Queries
User Variables
Transactions and Locking
Table Types
Module 8: Doing More with MySQL
Inserting Data Using Queries
Loading Data from Comma-Delimited Files
Writing Data into Comma-Delimited Files
Creating Tables with Queries
Updates and Deletes with Multiple Tables
Replacing Data
The EXPLAIN Statement
Module 9: Managing Users and Privileges
Understanding Users and Privileges
Creating and Using New Users
Privileges
The GRANT OPTION Privilege
How Privileges Interact
Users and Hosts
Checking Privileges
Revoking Privileges
Removing Users
Understanding and Changing Passwords
The Default Users
Devising a User Security Policy
Managing Privileges with SQL
Privileges and Performance
Resetting Forgotten MySQL Passwords
Part III. Advanced Topics
Module 10: Backups and Recovery
Dumping a Database as SQL Statements
Loading Data from an SQL Dump File
mysqlhotcopy
Scheduling Backups
The Binary Log
Checking and Repairing Corrupted Tables
Re-Creating Damaged Grant Tables
Resources
Module 11: Using an Options File
Configuring Options for the MySQL Monitor
Structure of the Options File
Scope of Options
Search Order for Options Files
Determining the Options in Effect
Module 12: Configuring and Tuning the Server
The MySQL Server Daemon
Server Variables
Checking Server Settings
Other Things to Consider
Resources
Part IV. Web Database Applications with PHP
Module 13: Web Database Applications
Building a Web Database Application
The Apache Web Server
Introducing PHP
Using a PHP-Enabled Web Hosting Site
Resources
Exercises
Module 14: PHP
Language Basics
Accessing MySQL Using PHP
Modularizing Code
Processing and Using User Data
The PHP Predefined Superglobal Variables
Untainting User Data
Sessions
The Reload Problem
Using PHP for Command-Line Scripts
Module 15: A PHP Application: The Wedding Gift Registry
Designing and Creating the Wedding Database
The Login Form
Passing a Message to a Script
Logging Users In and Out
The db.php Include File
Editing the List of Gifts
Loading Sample Gifts
Listing Gifts for Selection
Selecting and Deselecting Gift
Part V. Interacting with MySQL Using Perl
Module 16: Perl
Scripting With Perl
Module 17: Using Perl with MySQL
Connecting to the MySQL Server and Database
Handling Errors When Interacting with the Database
Using Queries That Return Answer Sets
Using Queries That Don’t Return Answer Sets
Binding Queries and Variables
Importing and Exporting Data
Handling NULL Values
Module 18: Serving Perl Pages to the Web
The Perl CGI Module
Processing User Input
A Note on mod_perl
Perl Security