You are previewing MySQL, Fifth Edition.
O'Reilly logo
MySQL, Fifth Edition

Book Description

MySQL, Fifth Edition by Paul DuBois
The definitive guide to using, programming and administering MySQL 5.5 and MySQL 5.6


MySQL provides a comprehensive guide to effectively using and administering the MySQL database management system (DBMS).

Author Paul DuBois describes everything from the basics of getting information into a database and formulating queries, to using MySQL with PHP or Perl to generate dynamic web pages, to writing your own programs that access MySQL databases, to administering MySQL servers. The book also includes a comprehensive reference section providing detailed information on MySQL’s structure, language, syntax, and APIs.

The fifth edition of this bestselling book has been meticulously revised and updated to thoroughly cover the latest features and capabilities of MySQL 5.5, as well as to add new coverage of features introduced with MySQL 5.6.

MySQL is an open source relational database management system (DBMS) that has experienced a phenomenal growth in popularity and use. Known for its speed and ease of use, MySQL has proven itself to be particularly well-suited for developing database-backed websites and applications. MySQL runs on anything from modest hardware all the way up to enterprise servers, and its performance rivals any database system put up against it.

Paul DuBois' MySQL, Fifth Edition, is the definitive guide to fully exploiting all the power and versatility of MySQL 5.5 and MySQL 5.6

Contents at a Glance


Part I: General MySQL Use
Chapter 1 Getting Started with MySQL
Chapter 2 Using SQL to Manage Data
Chapter 3 Data Types
Chapter 4 Views and Stored Programs
Chapter 5 Query Optimization

Part II: Using MySQL Programming Interfaces
Chapter 6 Introduction to MySQL Programming
Chapter 7 Writing MySQL Programs Using C
Chapter 8 Writing MySQL Programs Using Perl DBI
Chapter 9 Writing MySQL Programs Using PHP

Part III: MySQL Administration
Chapter 10 Introduction to MySQL Administration
Chapter 11 The MySQL Data Directory
Chapter 12 General MySQL Administration
Chapter 13 Security and Access Control
Chapter 14 Database Maintenance, Backups, and Replication

Part IV: Appendixes
Appendix A Software Required to Use This Book
Appendix B Data Type Reference
Appendix C Operator and Function Reference
Appendix D System, Status, and User Variable Reference
Appendix E SQL Syntax Reference
Appendix F MySQL Program Reference
Appendix G C API Reference
Appendix H Perl DBI API Reference
Appendix I PHP API Reference

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Developer’s Library
  4. Contents at a Glance
  5. Table of Contents
  6. About the Author
  7. Acknowledgments
  8. We Want to Hear from You!
  9. Reader Services
  10. Introduction
    1. Why Choose MySQL?
    2. What You Can Expect from This Book
    3. Road Map to This Book
    4. How to Read This Book
    5. Versions of Software Covered in This Book
    6. Conventions Used in This Book
    7. Additional Resources
  11. Part I. General MySQL Use
    1. 1. Getting Started with MySQL
      1. 1.1. How MySQL Can Help You
      2. 1.2. A Sample Database
      3. 1.3. Basic Database Terminology
      4. 1.4. A MySQL Tutorial
      5. 1.5. Tips for Interacting with mysql
      6. 1.6. Where to Now?
    2. 2. Using SQL to Manage Data
      1. 2.1. The Server SQL Mode
      2. 2.2. MySQL Identifier Syntax and Naming Rules
      3. 2.3. Case Sensitivity in SQL Statements
      4. 2.4. Character Set Support
      5. 2.5. Selecting, Creating, Dropping, and Altering Databases
      6. 2.6. Creating, Dropping, Indexing, and Altering Tables
      7. 2.7. Obtaining Database Metadata
      8. 2.8. Performing Multiple-Table Retrievals with Joins
      9. 2.9. Performing Multiple-Table Retrievals with Subqueries
      10. 2.10. Performing Multiple-Table Retrievals with UNION
      11. 2.11. Multiple-Table Deletes and Updates
      12. 2.12. Performing Transactions
      13. 2.13. Foreign Keys and Referential Integrity
      14. 2.14. Using FULLTEXT Searches
    3. 3. Data Types
      1. 3.1. Data Value Categories
      2. 3.2. MySQL Data Types
      3. 3.3. How MySQL Handles Invalid Data Values
      4. 3.4. Working with Sequences
      5. 3.5. Expression Evaluation and Type Conversion
      6. 3.6. Choosing Data Types
    4. 4. Views and Stored Programs
      1. 4.1. Using Views
      2. 4.2. Using Stored Programs
      3. 4.3. Security for Views and Stored Programs
    5. 5. Query Optimization
      1. 5.1. Using Indexing
      2. 5.2. The MySQL Query Optimizer
      3. 5.3. Choosing Data Types for Efficient Queries
      4. 5.4. Choosing Table Storage Formats for Efficient Queries
      5. 5.5. Loading Data Efficiently
      6. 5.6. Scheduling, Locking, and Concurrency
  12. Part II. Using MySQL Programming Interfaces
    1. 6. Introduction to MySQL Programming
      1. 6.1. Why Write Your Own MySQL Programs?
      2. 6.2. APIs Available for MySQL
      3. 6.3. Choosing an API
    2. 7. Writing MySQL Programs Using C
      1. 7.1. Compiling and Linking Client Programs
      2. 7.2. Connecting to the Server
      3. 7.3. Handling Errors and Processing Command Options
      4. 7.4. Processing SQL Statements
      5. 7.5. An Interactive Statement-Execution Program
      6. 7.6. Writing Clients That Include SSL Support
      7. 7.7. Using Multiple-Statement Execution
      8. 7.8. Using Server-Side Prepared Statements
      9. 7.9. Using Prepared CALL Support
    3. 8. Writing MySQL Programs Using Perl DBI
      1. 8.1. Perl Script Characteristics
      2. 8.2. Perl DBI Overview
      3. 8.3. Putting DBI to Work
      4. 8.4. Using DBI in Web Applications
    4. 9. Writing MySQL Programs Using PHP
      1. 9.1. PHP Overview
      2. 9.2. Putting PHP to Work
  13. Part III. MySQL Administration
    1. 10. Introduction to MySQL Administration
      1. 10.1. MySQL Components
      2. 10.2. General MySQL Administration
      3. 10.3. Access Control and Security
      4. 10.4. Database Maintenance, Backups, and Replication
    2. 11. The MySQL Data Directory
      1. 11.1. The Data Directory Location
      2. 11.2. Structure of the Data Directory
      3. 11.3. Relocating Data Directory Contents
    3. 12. General MySQL Administration
      1. 12.1. Securing a New MySQL Installation
      2. 12.2. Arranging for MySQL Server Startup and Shutdown
      3. 12.3. Using System and Status Variables
      4. 12.4. The Plugin Interface
      5. 12.5. Storage Engine Configuration
      6. 12.6. Globalization Issues
      7. 12.7. Server Tuning
      8. 12.8. Server Logs
      9. 12.9. Running Multiple Servers
      10. 12.10. Updating MySQL
    4. 13. Security and Access Control
      1. 13.1. Securing Filesystem Access to MySQL
      2. 13.2. Managing MySQL User Accounts
      3. 13.3. Grant Table Structure and Contents
      4. 13.4. How the Server Controls Client Access
      5. 13.5. Setting Up Secure Connections Using SSL
    5. 14. Database Maintenance, Backups, and Replication
      1. 14.1. Principles of Preventive Maintenance
      2. 14.2. Performing Database Maintenance with the Server Running
      3. 14.3. General Preventive Maintenance
      4. 14.4. Making Database Backups
      5. 14.5. Copying Databases to Another Server
      6. 14.6. Checking and Repairing Database Tables
      7. 14.7. Using Backups for Data Recovery
      8. 14.8. Setting Up Replication Servers
  14. Part IV. Appendixes
    1. A. Software Required to Use This Book
      1. A.1. Obtaining the sampdb Sample Database Distribution
      2. A.2. Obtaining MySQL and Related Software
      3. A.3. MySQL Installation Notes
      4. A.4. Perl DBI Installation Notes
      5. A.5. PHP and PDO Installation Notes
    2. B. Data Type Reference
      1. B.1. Numeric Types
      2. B.2. String Types
      3. B.3. Temporal (Date and Time) Types
    3. C. Operator and Function Reference
      1. C.1. Operators
      2. C.2. Functions
    4. D. System, Status, and User Variable Reference
      1. D.1. System Variables
      2. D.2. Status Variables
      3. D.3. User-Defined Variables
    5. E. SQL Syntax Reference
      1. E.1. SQL Statement Syntax (Noncompound Statements)
      2. E.2. SQL Statement Syntax (Compound Statements)
      3. E.3. Comment Syntax
    6. F. MySQL Program Reference
      1. F.1. Displaying a Program’s Help Message
      2. F.2. Specifying Program Options
      3. F.3. myisamchk
      4. F.4. mysql
      5. F.5. mysql.server
      6. F.6. mysql_config
      7. F.7. mysql_install_db
      8. F.8. mysql_upgrade
      9. F.9. mysqladmin
      10. F.10. mysqlbinlog
      11. F.11. mysqlcheck
      12. F.12. mysqld
      13. F.13. mysqld_multi
      14. F.14. mysqld_safe
      15. F.15. mysqldump
      16. F.16. mysqlimport
      17. F.17. mysqlshow
      18. F.18. perror
  15. Index
  16. G. C API Reference
    1. G.1. Compiling and Linking
    2. G.2. C API Data Structures
    3. G.3. C API Functions
  17. H. Perl DBI API Reference
    1. H.1. Writing Scripts
    2. H.2. DBI Methods
    3. H.3. DBI Utility Functions
    4. H.4. DBI Attributes
    5. H.5. DBI Environment Variables
  18. I. PHP API Reference
    1. I.1. Writing PHP Scripts
    2. I.2. PDO Classes
    3. I.3. PDO Methods