|
|
|
Copyright
|
|
|
|
About the Author
|
|
|
|
Acknowledgments
|
|
|
|
|
Third Edition
|
|
|
|
|
Second Edition
|
|
|
|
|
First Edition
|
|
|
|
Tell Us What You Think
|
|
|
|
Introduction
|
|
|
|
|
Why Choose MySQL?
|
|
|
|
|
Already Running Another RDBMS?
|
|
|
|
|
Tools Provided with MySQL
|
|
|
|
|
What You Can Expect from This Book
|
|
|
|
|
Road Map to This Book
|
|
|
|
|
How to Read This Book
|
|
|
|
|
Versions of Software Covered in This Book
|
|
|
|
|
Conventions Used in This Book
|
|
|
|
|
Additional Resources
|
|
|
|
Chapter 1. Getting Started with MySQL and SQL
|
|
|
|
|
How MySQL Can Help You
|
|
|
|
|
A Sample Database
|
|
|
|
|
Basic Database Terminology
|
|
|
|
|
A MySQL Tutorial
|
|
|
|
|
Tips for Interacting with mysql
|
|
|
|
|
Where to Now?
|
|
|
|
Chapter 2. MySQL SQL Syntax and Use
|
|
|
|
|
MySQL Naming Rules
|
|
|
|
|
The Server SQL Mode
|
|
|
|
|
Character Set Support
|
|
|
|
|
Selecting, Creating, Dropping, and Altering Databases
|
|
|
|
|
Creating, Dropping, Indexing, and Altering Tables
|
|
|
|
|
Getting Information About Databases and Tables
|
|
|
|
|
Performing Multiple-Table Retrievals with Joins
|
|
|
|
|
Performing Multiple-Table Retrievals with Subqueries
|
|
|
|
|
Performing Multiple-Table Retrievals with UNION
|
|
|
|
|
Multiple-Table Deletes and Updates
|
|
|
|
|
Performing Transactions
|
|
|
|
|
Foreign Keys and Referential Integrity
|
|
|
|
|
Using FULLTEXT Searches
|
|
|
|
|
New Features in MySQL 5.0
|
|
|
|
Chapter 3. Working with Data in MySQL
|
|
|
|
|
Categories of Data Values
|
|
|
|
|
MySQL Data Types
|
|
|
|
|
How MySQL Handles Invalid Data Values
|
|
|
|
|
Working with Sequences
|
|
|
|
|
Choosing Data Types
|
|
|
|
|
Expression Evaluation and Type Conversion
|
|
|
|
Chapter 4. Query Optimization
|
|
|
|
|
Using Indexing
|
|
|
|
|
The MySQL Query Optimizer
|
|
|
|
|
Data Type Choices and Query Efficiency
|
|
|
|
|
Loading Data Efficiently
|
|
|
|
|
Scheduling and Locking Issues
|
|
|
|
|
Optimization for Administrators
|
|
|
|
Chapter 5. Introduction to MySQL Programming
|
|
|
|
|
Why Write Your Own MySQL Programs?
|
|
|
|
|
APIs Available for MySQL
|
|
|
|
|
Choosing an API
|
|
|
|
Chapter 6. Writing MySQL Programs Using C
|
|
|
|
|
General Instructions for Building Client Programs
|
|
|
|
|
Connecting to the Server
|
|
|
|
|
Handling Errors and Processing Command Options
|
|
|
|
|
Processing SQL Statements
|
|
|
|
|
An Interactive Statement-Execution Program
|
|
|
|
|
Writing Clients That Include SSL Support
|
|
|
|
|
Using the Embedded Server Library
|
|
|
|
|
Using Multiple-Statement Execution
|
|
|
|
|
Using Server-Side Prepared Statements
|
|
|
|
Chapter 7. Writing MySQL Programs Using Perl DBI
|
|
|
|
|
Perl Script Characteristics
|
|
|
|
|
Perl DBI Overview
|
|
|
|
|
Putting DBI to Work
|
|
|
|
|
Using DBI in Web Applications
|
|
|
|
Chapter 8. Writing MySQL Programs Using PHP
|
|
|
|
|
PHP Overview
|
|
|
|
|
Putting PHP to Work
|
|
|
|
Chapter 9. Introduction to MySQL Administration
|
|
|
|
|
Overview of Administrative Duties
|
|
|
|
|
General Administration
|
|
|
|
|
Security
|
|
|
|
|
Database Repair and Maintenance
|
|
|
|
Chapter 10. The MySQL Data Directory
|
|
|
|
|
Location of the Data Directory
|
|
|
|
|
Structure of the Data Directory
|
|
|
|
|
Relocating Data Directory Contents
|
|
|
|
Chapter 11. General MySQL Administration
|
|
|
|
|
Securing a New MySQL Installation
|
|
|
|
|
Arranging for MySQL Server Startup and Shutdown
|
|
|
|
|
Managing MySQL User Accounts
|
|
|
|
|
Maintaining Log Files
|
|
|
|
|
Tuning the Server
|
|
|
|
|
Storage Engine Configuration
|
|
|
|
|
Controlling How the Server Listens for Connections
|
|
|
|
|
Enabling or Disabling LOCAL Capability for LOAD DATA
|
|
|
|
|
Configuring Backward Compatibility for Password Handling
|
|
|
|
|
Internationalization and Localization Issues
|
|
|
|
|
Running Multiple Servers
|
|
|
|
|
Setting Up Replication Servers
|
|
|
|
|
Updating MySQL
|
|
|
|
Chapter 12. MySQL and Security
|
|
|
|
|
Internal Security: Preventing Unauthorized Filesystem Access
|
|
|
|
|
External Security: Preventing Unauthorized Network Access
|
|
|
|
|
Setting Up Secure Connections
|
|
|
|
Chapter 13. Database Backups, Maintenance, and Repair
|
|
|
|
|
Performing Database Maintenance with the Server Running
|
|
|
|
|
General Preventive Maintenance
|
|
|
|
|
Making Database Backups
|
|
|
|
|
Copying Databases to Another Server
|
|
|
|
|
Checking and Repairing Database Tables
|
|
|
|
|
Using Backups for Data Recovery
|
|
|
|
Appendix A. Obtaining and Installing Software
|
|
|
|
|
Obtaining the sampdb Sample Database Distribution
|
|
|
|
|
Obtaining MySQL and Related Software
|
|
|
|
|
Choosing a Version of MySQL
|
|
|
|
|
Installing MySQL on Unix
|
|
|
|
|
Installing MySQL on Windows
|
|
|
|
Appendix B. Data Type Reference
|
|
|
|
|
Numeric Types
|
|
|
|
|
String Types
|
|
|
|
|
Date and Time Types
|
|
|
|
|
Spatial Types
|
|
|
|
Appendix C. Operator and Function Reference
|
|
|
|
|
Operators
|
|
|
|
|
Functions
|
|
|
|
Appendix D. System, Status, and User Variable Reference
|
|
|
|
|
System Variables
|
|
|
|
|
Session-Only System Variables
|
|
|
|
|
Status Variables
|
|
|
|
|
User-Defined Variables
|
|
|
|
Appendix E. SQL Syntax Reference
|
|
|
|
|
SQL Statement Syntax
|
|
|
|
|
Stored Routine Syntax
|
|
|
|
|
Comment Syntax
|
|
|
|
Appendix F. MySQL Program Reference
|
|
|
|
|
Specifying Program Options
|
|
|
|
|
libmysqld
|
|
|
|
|
myisamchk
|
|
|
|
|
myisampack
|
|
|
|
|
mysql
|
|
|
|
|
mysql.server
|
|
|
|
|
mysql_config
|
|
|
|
|
mysql_install_db
|
|
|
|
|
mysqladmin
|
|
|
|
|
mysqlbinlog
|
|
|
|
|
mysqlcheck
|
|
|
|
|
mysqld
|
|
|
|
|
mysqld_multi
|
|
|
|
|
mysqld_safe
|
|
|
|
|
mysqldump
|
|
|
|
|
mysqlhotcopy
|
|
|
|
|
mysqlimport
|
|
|
|
|
mysqlshow
|
|
|
|
|
perror
|
|
|
|
Appendix G. C API Reference
|
|
|
|
|
Compiling and Linking
|
|
|
|
|
C API Data Types
|
|
|
|
|
C API Functions
|
|
|
|
Appendix H. Perl DBI API Reference
|
|
|
|
|
Writing Scripts
|
|
|
|
|
DBI Methods
|
|
|
|
|
DBI Utility Functions
|
|
|
|
|
DBI Attributes
|
|
|
|
|
DBI Environment Variables
|
|
|
|
Appendix I. PHP and PEAR DB API Reference
|
|
|
|
|
Writing PHP Scripts
|
|
|
|
|
PEAR DB Module Classes
|
|
|
|
|
PEAR DB Module Methods
|
|
|
|
Index
|