Cover image for MySQL in a Nutshell, 2nd Edition

Book description

When you need to find the right SQL keyword or MySQL client command-line option right away, turn to this convenient reference, known for the same speed and flexibility as the system it covers so thoroughly. MySQL is packed with so many capabilities that the odds of remembering a particular function or statement at the right moment are pretty slim. With MySQL in a Nutshell, you get the details you need, day in and day out, in one concise and extremely well organized book. The new edition contains all the commands and programming information for version 5.1, including new features and language interfaces. It's ideal for anyone using MySQL, from novices who need to get up to speed to advanced users who want a handy reference. Like all O'Reilly Nutshell references, it's easy to use and highly authoritative, written by the editor of the MySQL Knowledge Base at MySQL AB, the creator and owner of MySQL. Inside, you'll find:

  • A thorough reference to MySQL statements, functions, and administrative utilities

  • Several tutorial chapters to help newcomers get started

  • Programming language APIs for PHP, Perl, and C

  • Brief tutorials at the beginning of each API chapter to help anyone, regardless of experience level, understand and master unfamiliar territory

  • New chapters on replication, triggers, and stored procedures

  • Plenty of new examples of how MySQL is used in practice

  • Useful tips to help you get through the most difficult subjects

Whether you employ MySQL in a mission-critical, heavy-use environment or for applications that are more modest, this book puts a wealth of easy-to-find information at your fingertips, saving you hundreds of hours of trial and error and tedious online searching. If you're ready to take advantage of everything MySQL has to offer, MySQL in a Nutshell has precisely what it takes.

Table of Contents

  1. Dedication
  2. Special Upgrade Offer
  3. Preface
    1. The Purpose of This Book
    2. How This Book Is Organized
      1. Part I, Introduction and Tutorials
      2. Part II, SQL Statements and Functions
      3. Part III, MySQL Server and Client Tools
      4. Part IV, MySQL API
      5. Appendixes
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Request for Comments
    6. Safari® Enabled
    7. Acknowledgments
  4. I. Introduction and Tutorials
    1. 1. Introduction to MySQL
      1. The Value of MySQL
      2. The MySQL Package
      3. Licensing
      4. Mailing Lists
      5. Books and Other Publications
    2. 2. Installing MySQL
      1. Choosing a Distribution
      2. Unix Source Distributions
      3. Unix Binary Distributions
      4. Linux RPM Distributions
      5. Macintosh OS X Distributions
      6. Novell NetWare Distributions
      7. Windows Distributions
      8. Postinstallation
    3. 3. MySQL Basics
      1. The mysql Client
      2. Creating a Database and Tables
      3. Show Me
      4. Inserting Data
      5. Selecting Data
      6. Ordering, Limiting, and Grouping
      7. Analyzing and Manipulating Data
      8. Changing Data
      9. Deleting Data
      10. Searching Data
      11. Importing Data in Bulk
      12. Command-Line Interface
      13. Conclusion
  5. II. SQL Statements and Functions
    1. 4. Security and User Statements and Functions
      1. Statements and Functions
      2. SQL Statements in Alphabetical Order
      3. Functions in Alphabetical Order
    2. 5. Database and Table Schema Statements
      1. Statements and Clauses in Alphabetical Order
    3. 6. Data Manipulation Statements and Functions
      1. Statements and Functions Grouped by Characteristics
        1. Data Manipulation Statements
        2. Transaction Statements
        3. Related Functions
      2. Statements and Clauses in Alphabetical Order
      3. Functions in Alphabetical Order
    4. 7. Table and Server Administration Statements and Functions
      1. Statements and Clauses in Alphabetical Order
      2. Functions in Alphabetical Order
    5. 8. Replication Statements and Functions
      1. Merits of Replication
      2. Replication Process
      3. The Replication User Account
      4. Configuring the Servers
      5. Copying Databases and Starting Replication
        1. Using mysqldump
        2. Alternative Methods for Making Copies
      6. Starting Replication
      7. Backups with Replication
      8. SQL Statements and Functions in Alphabetical Order
      9. Replication States
        1. Master BinLog Dump Thread States
        2. Slave I/O Thread States
        3. Slave SQL Thread States
    6. 9. Stored Routines Statements
      1. Statements in Alphabetical Order
    7. 10. Aggregate Clauses, Aggregate Functions, and Subqueries
      1. Aggregate Functions in Alphabetical Order
      2. Subqueries
        1. Single Field Subqueries
        2. Multiple Fields Subqueries
        3. Results Set Subqueries
    8. 11. String Functions
      1. String Functions Grouped by Type
        1. Character Sets and Collation
        2. Converting
        3. Formatting
        4. Expressions
        5. Extracting
        6. Manipulating
      2. String Functions in Alphabetical Order
    9. 12. Date and Time Functions
      1. Date and Time Functions Grouped by Type
        1. Determining the Date or Time
        2. Extracting and Formatting the Date or Time
        3. Calculating and Modifying the Date or Time
      2. Date and Time Functions in Alphabetical Order
    10. 13. Mathematical Functions
      1. Functions in Alphabetical Order
    11. 14. Flow Control Functions
      1. Functions in Alphabetical Order
  6. III. MySQL Server and Client Tools
    1. 15. MySQL Server and Client
      1. mysql Client
      2. mysqld Server
      3. mysqld_multi
      4. mysqld_safe
    2. 16. Command-Line Utilities
      1. comp_err
      2. make_binary_distribution
      3. msql2mysql
      4. my_print_defaults
      5. myisam_ftdump
      6. myisamchk
      7. myisamlog
      8. myisampack
      9. mysql_convert_table_format
      10. mysql_find_rows
      11. mysql_fix_extensions
      12. mysql_fix_privilege_tables
      13. mysql_setpermission
      14. mysql_tableinfo
      15. mysql_upgrade
      16. mysql_waitpid
      17. mysql_zap
      18. mysqlaccess
      19. mysqladmin
      20. mysqlbinlog
      21. mysqlbug
      22. mysqlcheck
      23. mysqldump
      24. mysqldumpslow
      25. mysqlhotcopy
      26. mysqlimport
      27. mysqlshow
      28. mysqlslap
      29. perror
      30. replace
      31. resolveip
      32. resolve_stack_dump
  7. IV. APIs and Connectors
    1. 17. C API
      1. Using C with MySQL
        1. Connecting to MySQL
        2. Querying MySQL
      2. Functions in Alphabetical Order
      3. C API Datatypes
    2. 18. Perl API
      1. Using Perl DBI with MySQL
        1. Connecting to MySQL
        2. Executing an SQL Statement
        3. Capturing Data
        4. Disconnecting from MySQL
        5. Temporarily Storing Results
      2. Perl DBI Reference
      3. Attributes for Handles
        1. Only
        2. Only
    3. 19. PHP API
      1. Using PHP with MySQL
        1. Connecting to MySQL
        2. Querying MySQL
      2. PHP MySQL Functions in Alphabetical Order
  8. V. Appendixes
    1. A. Data Types
      1. Numeric Data Types
      2. Date and Time Data Types
      3. String Data Types
    2. B. Operators
      1. Arithmetic Operators
      2. Relational Operators
      3. Logical Operators
      4. Bitwise Operators
      5. Regular Expressions
    3. C. Server and Environment Variables
  9. Index
  10. About the Author
  11. Colophon
  12. Special Upgrade Offer
  13. Copyright