Home > Store

MySQL Administrator's Guide

Register your product to gain access to bonus material or receive a coupon.

MySQL Administrator's Guide

  • By
  • Published Jul 26, 2004 by MySQL Press.

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2005
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32634-5
  • ISBN-13: 978-0-672-32634-9

If you are not already one of the 4 million plus users of the MySQL database, you will want to become one after reading this book. MySQL Administrator's Guide is the official guide to installing, administering and working with MySQL 5.0 and MySQL databases. Starting with the basics, you will learn to store, manage and retrieve data in a MySQL database and to eventually manipulate the code behind MySQL 5.0 to customize your database. With the clear examples and tips provided in this comprehensive learning guide, you can become a MySQL expert in no time.

Sample Content

Online Sample Chapters

Using MySQL Programs

Using MySQL Programs

Table of Contents

1. General Information.

    About This Manual.

      Conventions Used in This Manual.

    Overview of the MySQL Database Management System.

      History of MySQL.

      The Main Features of MySQL.

      MySQL Stability.

      How Big MySQL Tables Can Be.

      Year 2000 Compliance.

    Overview of MySQL AB.

      The Business Model and Services of MySQL AB.

      Contact Information.

    MySQL Support and Licensing.

      Support Offered by MySQL AB.

      Copyrights and Licenses Used by MySQL.

      MySQL Licenses.

      MySQL AB Logos and Trademarks.

    MySQL Development Roadmap.

      MySQL 4.0 in a Nutshell.

      MySQL 4.1 in a Nutshell.

      MySQL 5.0: The Next Development Release.

    MySQL and the Future (the TODO).

      New Features Planned for 4.1.

      New Features Planned for 5.0.

      New Features Planned for 5.1.

      New Features Planned for the Near Future.

      New Features Planned for the Mid-Term Future.

      New Features We Don't Plan to Implement.

    MySQL Information Sources.

      MySQL Mailing Lists.

      MySQL Community Support on IRC (Internet Relay Chat).

    MySQL Standards Compliance.

      What Standards MySQL Follows.

      Selecting SQL Modes.

      Running MySQL in ANSI Mode.

      MySQL Extensions to Standard SQL.

      MySQL Differences from Standard SQL.

      How MySQL Deals with Constraints.

      Known Errors and Design Deficiencies in MySQL.

2. Installing MySQL.

    General Installation Issues.

      Operating Systems Supported by MySQL.

      Choosing Which MySQL Distribution to Install.

      How to Get MySQL.

      Verifying Package Integrity Using MD5 Checksums or GnuPG.

       Installation Layouts.

    Standard MySQL Installation Using a Binary Distribution.

      Installing MySQL on Windows.

      Installing MySQL on Linux.

      Installing MySQL on Mac OS X.

      Installing MySQL on NetWare.

      Installing MySQL on Other Unix-Like Systems.

    MySQL Installation Using a Source Distribution.

      Source Installation Overview.

      Typical configure Options.

      Installing from the Development Source Tree.

      Dealing with Problems Compiling MySQL.

      MIT-pthreads Notes.

      Installing MySQL from Source on Windows.

      Compiling MySQL Clients on Windows.

    Post-Installation Setup and Testing.

      Windows Post-Installation Procedures.

      Unix Post-Installation Procedures.

      Starting and Stopping MySQL Automatically.

      Starting and Troubleshooting the MySQL Server.

      Securing the Initial MySQL Accounts.

    Upgrading/Downgrading MySQL.

      Upgrading from Version 4.1 to 5.0.

      Upgrading from Version 4.0 to 4.1.

      Upgrading from Version 3.23 to 4.0.

      Upgrading from Version 3.22 to 3.23.

      Upgrading from Version 3.21 to 3.22.

      Upgrading from Version 3.20 to 3.21.

      Upgrading MySQL Under Windows.

      Upgrading the Grant Tables.

      Copying MySQL Databases to Another Machine.

    Operating System–Specific Notes.

       Linux Notes.

      Mac OS X Notes.

      Solaris Notes.

      BSD Notes.

      Other Unix Notes.

      OS/2 Notes.

      BeOS Notes.

    Perl Installation Notes.

      Installing Perl on Unix.

      Installing ActiveState Perl on Windows.

      Problems Using the Perl DBI/DBD Interface.

3. Using MySQL Programs.

    Overview of MySQL Programs.

    Invoking MySQL Programs.

    Specifying Program Options.

      Using Options on the Command Line.

      Using Option Files.

      Using Environment Variables to Specify Options.

      Using Options to Set Program Variables.

4. Database Administration.

    The MySQL Server and Server Startup Scripts.

      Overview of the Server-Side Scripts and Utilities.

      The mysqld-max Extended MySQL Server.

      The mysqld_safe Server Startup Script.

      The mysql.server Server Startup Script.

      The mysqld_multi Program for Managing Multiple MySQL Servers.

    Configuring the MySQL Server.

      mysqld Command-Line Options.

      The Server SQL Mode.

      Server System Variables.

      Server Status Variables.

    General Security Issues.

      General Security Guidelines.

      Making MySQL Secure Against Attackers.

      Startup Options for mysqld Concerning Security.

      Security Issues with LOAD DATA LOCAL.

    The MySQL Access Privilege System.

      What the Privilege System Does.

      How the Privilege System Works.

      Privileges Provided by MySQL.

      Connecting to the MySQL Server.

      Access Control, Stage 1: Connection Verification.

      Access Control, Stage 2: Request Verification.

      When Privilege Changes Take Effect.

      Causes of Access denied Errors.

      Password Hashing in MySQL 4.1.

    MySQL User Account Management.

      MySQL Usernames and Passwords.

      Adding New User Accounts to MySQL.

      Removing User Accounts from MySQL.

      Limiting Account Resources.

      Assigning Account Passwords.

      Keeping Your Password Secure.

      Using Secure Connections.

    Disaster Prevention and Recovery.

      Database Backups.

      Table Maintenance and Crash Recovery.

      Setting Up a Table Maintenance Schedule.

      Getting Information About a Table.

    MySQL Localization and International Usage.

      The Character Set Used for Data and Sorting.

      Setting the Error Message Language.

      Adding a New Character Set.

      The Character Definition Arrays.

      String Collating Support.

      Multi-Byte Character Support.

      Problems with Character Sets.

    The MySQL Log Files.

      The Error Log.

      The General Query Log.

      The Update Log.

      The Binary Log.

      The Slow Query Log.

      Log File Maintenance.

    Running Multiple MySQL Servers on the Same Machine.

      Running Multiple Servers on Windows.

      Running Multiple Servers on Unix.

      Using Client Programs in a Multiple-Server Environment.

    The MySQL Query Cache.

      How the Query Cache Operates.

      Query Cache SELECT Options.

      Query Cache Configuration.

      Query Cache Status and Maintenance.

5. Replication in MySQL.

    Introduction to Replication.

    Replication Implementation Overview.

    Replication Implementation Details.

      Replication Master Thread States.

      Replication Slave I/O Thread States.

      Replication Slave SQL Thread States.

      Replication Relay and Status Files.

    How to Set Up Replication.

    Replication Compatibility Between MySQL Versions.

    Upgrading a Replication Setup.

      Upgrading Replication to 4.0 or 4.1.

      Upgrading Replication to 5.0.

    Replication Features and Known Problems.

    Replication Startup Options.

    Replication FAQ.

    Troubleshooting Replication.

    Reporting Replication Bugs

6. MySQL Optimization.

    Optimization Overview.

      MySQL Design Limitations and Tradeoffs.

      Designing Applications for Portability.

      What We Have Used MySQL For.

      The MySQL Benchmark Suite.

      Using Your Own Benchmarks.

    Optimizing SELECT Statements and Other Queries.

      EXPLAIN Syntax (Get Information About a SELECT).

      Estimating Query Performance.

      Speed of SELECT Queries.

      How MySQL Optimizes WHERE Clauses.

      How MySQL Optimizes OR Clauses.

      How MySQL Optimizes IS NULL.

      How MySQL Optimizes DISTINCT.

      How MySQL Optimizes LEFT JOIN and RIGHT JOIN.

      How MySQL Optimizes ORDER BY.

      How MySQL Optimizes LIMIT.

      How to Avoid Table Scans.

      Speed of INSERT Queries.

      Speed of UPDATE Queries.

      Speed of DELETE Queries.

      Other Optimization Tips.

    Locking Issues.

      Locking Methods.

      Table Locking Issues.

    Optimizing Database Structure.

      Design Choices.

      Make Your Data as Small as Possible.

       Column Indexes.

      Multiple-Column Indexes.

      How MySQL Uses Indexes.

      The MyISAM Key Cache.

      How MySQL Counts Open Tables.

      How MySQL Opens and Closes Tables.

      Drawbacks to Creating Many Tables in the Same Database.

    Optimizing the MySQL Server.

      System Factors and Startup Parameter Tuning.

      Tuning Server Parameters.

      How Compiling and Linking Affects the Speed of MySQL.

      How MySQL Uses Memory.

      How MySQL Uses DNS.

    Disk Issues.

      Using Symbolic Links.

7. MySQL Client and Utility Programs.

    Overview of the Client-Side Scripts and Utilities.

    myisampack, the MySQL Compressed Read-Only Table Generator.

    mysql, the Command-Line Tool.

      mysql Commands.

      Executing SQL Statements from a Text File.

      mysql Tips.

    mysqladmin, Administering a MySQL Server.

    The mysqlbinlog Binary Log Utility.

    mysqlcc, the MySQL Control Center.

    The mysqlcheck Table Maintenance and Repair Program.

    The mysqldump Database Backup Program.

    The mysqlhotcopy Database Backup Program.

    The mysqlimport Data Import Program.

    mysqlshow, Showing Databases, Tables, and Columns.

    perror, Explaining Error Codes.

    The replace String-Replacement Utility.

8. MySQL Storage Engines and Table Types.

    The MyISAM Storage Engine.

      MyISAM Startup Options.

      Space Needed for Keys.

      MyISAM Table Storage Formats.

      MyISAM Table Problems.

    The MERGE Storage Engine.

      MERGE Table Problems.

    The MEMORY (HEAP) Storage Engine.

    The BDB (BerkeleyDB) Storage Engine.

      Operating Systems Supported by BDB.

      Installing BDB.

      BDB Startup Options.

      Characteristics of BDB Tables.

      Things We Need to Fix for BDB.

      Restrictions on BDB Tables.

      Errors That May Occur When Using BDB Tables.

    The ISAM Storage Engine.

9. The InnoDB Storage Engine.

    InnoDB Overview.

    InnoDB Contact Information.

     InnoDB in MySQL 3.23.

    InnoDB Configuration.

    InnoDB Startup Options.

    Creating the InnoDB Tablespace.

      Dealing with InnoDB Initialization Problems.

    Creating InnoDB Tables.

      How to Use Transactions in InnoDB with Different APIs.

      Converting MyISAM Tables to InnoDB.

      How an AUTO_INCREMENT Column Works in InnoDB.

      FOREIGN KEY Constraints.

      InnoDB and MySQL Replication.

      Using Per-Table Tablespaces.

    Adding and Removing InnoDB Data and Log Files.

    Backing Up and Recovering an InnoDB Database.

      Forcing Recovery.

      Checkpoints.

    Moving an InnoDB Database to Another Machine.

    InnoDB Transaction Model and Locking.

      InnoDB and AUTOCOMMIT.

      InnoDB and TRANSACTION ISOLATION LEVEL.

      Consistent Non-Locking Read.

      Locking Reads SELECT ... FOR UPDATE and SELECT ... LOCK IN SHARE MODE.

      Next-Key Locking: Avoiding the Phantom Problem.

      An Example of How the Consistent Read Works in InnoDB.

      Locks Set by Different SQL Statements in InnoDB.

      When Does MySQL Implicitly Commit or Roll Back a Transaction?

      Deadlock Detection and Rollback.

      How to Cope with Deadlocks.

    InnoDB Performance Tuning Tips.

      SHOW INNODB STATUS and the InnoDB Monitors.

    Implementation of Multi-Versioning.

    Table and Index Structures.

      Physical Structure of an Index.

      Insert Buffering.

      Adaptive Hash Indexes.

      Physical Record Structure.

    File Space Management and Disk I/O.

      Disk I/O.

      Using Raw Devices for the Tablespace.

      File Space Management.

      Defragmenting a Table.

    Error Handling.

      InnoDB Error Codes.

      Operating System Error Codes.

    Restrictions on InnoDB Tables.

    InnoDB Troubleshooting.

      Troubleshooting InnoDB Data Dictionary Operations.

10. Introduction to MaxDB.

    History of MaxDB.

    Licensing and Support.

    MaxDB-Related Links.

     Basic Concepts of MaxDB.

    Feature Differences Between MaxDB and MySQL.

    Interoperability Features Between MaxDB and MySQL.

    Reserved Words in MaxDB.

Appendix A. Troubleshooting Problems with MySQL Programs.

    How to Determine What Is Causing a Problem.

    Common Errors When Using MySQL Programs.

      Access denied.

      Can't connect to [local] MySQL server.

      Client does not support authentication protocol.

      Password Fails When Entered Interactively.

      Host 'host_name' is blocked.

      Too many connections.

      Out of memory.

      MySQL server has gone away.

      Packet too large.

      Communication Errors and Aborted Connections.

      The table is full.

      Can't create/write to file.

      Commands out of sync.

      Ignoring user.

      Table 'tbl_name' doesn't exist.

      Can't initialize character set.

      File Not Found.

    Installation-Related Issues.

      Problems Linking to the MySQL Client Library.

      How to Run MySQL as a Normal User.

      Problems with File Permissions.

    Administration-Related Issues.

       How to Reset the Root Password.

      What to Do If MySQL Keeps Crashing.

      How MySQL Handles a Full Disk.

      Where MySQL Stores Temporary Files.

      How to Protect or Change the MySQL Socket File /tmp/mysql.sock.

      Time Zone Problems.

Appendix B. Environment Variables.

Index.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020