SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
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.
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.