Professional Documents
Culture Documents
D61762GC10 TOC sg5 PDF
D61762GC10 TOC sg5 PDF
D61762GC10
Edition 1.0
D62341
Copyright © 2009, 2010, Oracle and/or its affiliates. All rights reserved.
Disclaimer
This document contains proprietary information, is provided under a license agreement containing restrictions on use and
disclosure, and is protected by copyright and other intellectual property laws. You may copy and print this document solely for
your own use in an Oracle training course. The document may not be modified or altered in any way. Except as expressly
permitted in your license agreement or allowed by law, you may not use, share, download, upload, copy, print, display,
perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express
authorization of Oracle.
The information contained in this document is subject to change without notice. If you find any problems in the document,
please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This
document is not warranted to be error-free.
This training manual may include references to materials, offerings, or products that were previously offered by Sun
Microsystems, Inc. Certain materials, offerings, services, or products may no longer be offered or provided.Oracle and its
affiliates cannot be held responsible for any such references should they appear in the text provided.
Trademark Notice
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used
under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark
licensed through X/Open Company, Ltd.
MySQL for Database Administrators Preface
iii
MySQL for Database Administrators Preface
The “shell” is your command interpreter. On Linux, this is typically a program such as sh, csh, or bash. On
Windows, the equivalent program is command.com or cmd.exe, typically run in a console window. When you enter
a command or statement shown in an example, do not type the prompt shown in the example.
Database, table, and column names must often be substituted into statements. To indicate that such substitution is
necessary, this manual uses db_name, tbl_name, and col_name. For example, you might see a statement like
this:
This means that if you were to enter a similar statement, you would supply your own database, table, and column
names for the placeholdes db_name, tbl_name, and col_name., perhaps like this:
mysql> SELECT author_name FROM biblio_db.author_list;
In syntax descriptions, square brackets ([ and ]) indicate optional words or clauses. For example, in the following
statement, IF EXISTS is optional:
When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars (pipe, |).
When one member from a set of choices may be chosen, the alternatives are listed within square brackets ([ and ]):
When one member from a set of choices must be chosen, the alternatives are listed within braces ({ and }):
iv
MySQL for Database Administrators Preface
An ellipsis (...) indicates the omission of a section of a statement, typically to provide a shorter version of more
complex syntax. For example, INSERT ... SELECT is shorthand for the form of INSERT statement that is
followed by a SELECT statement.
An ellipsis can also indicate that the preceding syntax element of a statement may be repeated. In the following
example, multiple reset_option values may be given, with each of those after the first preceded by commas:
Commands for setting shell variables are shown using Bourne shell syntax. For example, the sequence to set the CC
environment variable and run the configure command looks like this in Bourne shell syntax:
If you are using csh or tcsh, you must issue commands somewhat differently:
and
shell> ./configure
v
MySQL for Database Administrators Preface
Written exam This image is used to identify that the student is going to be tested
upon the material previously presented in the instructional material
Inline Lab Throughout the course the instructor will conduct labs in line with
the instruction, which are designed to help you to understand the
“nuts and bolts” (inner-workings) of the topic.
Further Practice This image is used to convey to the student that there is a final
Lab exercise to complete prior to the completion of the chapter.
Student notes This image identifies an area on a page designated for students to
write notes associated with the class.
123 Slide number box Indicates the number of an existing slide that corresponds to the text.
vi
MySQL for Database Administrators Preface
Acknowledgments
Sun Microsystems would like to thank the many individuals that played a part in bringing this training material to
the numerous students who will benefit from the knowledge and effort that each of these contributors put into the
training. Even though there were a large number of contributions from many Sun Microsystems' employees, the
following list of contributors played a vital role in developing this material and ensuring that its contents were
accurate, timely and most of all presented in a way that would benefit those that are utilizing it for the benefit of
improving their skills with MySQL.
● Max Mether, Course Development Manager
● Sarah Sproehnle, Lead Instructor, Subject Matter Expert
● Steven Jones, Subject Matter Expert
● Glynn Durham, Subject Matter Expert
● Jeffrey Gorton, Instructional Designer and Editor
vii
MySQL for Database Administrators Preface
5 Course Objectives
This instructor led, hands-on class will teach you how to properly install MySQL, create and execute backup
strategies, secure users privileges, set resource limitations, and access controls. In addition, this course will prepare
students for the MySQL Database Administrators certification exam.
● Describe the MySQL Architecture
● Install MySQL
● Upgrade to MySQL 5.1
● Perform the MySQL start and shutdown operations
● Configure MySQL server options at runtime
● Activate and manage numerous server logs
● Perform common DBA tasks utilizing MySQL programs
● Use INFORMATION_SCHEMA to access metadata
● Evaluate data types and character sets
● Understand data locking in MySQL
● Understand the multiple storage engines available in MySQL
● Maintain and Manage MySQL tables
● Perform backup and restore operations
● Manage user maintenance and security
6 ● Maintain integrity of a MySQL installation
● Understand the DBA's role concerning stored routines
● Utilize triggers for administration tasks
● Understand views
● Compare multiple environment options
● Verifying the security of the server
● Understand table partitioning
● Set up and schedule events for maintenance
● Describe introductory performance tuning techniques
● Describe introductory high availability techniques
xi
MySQL for Database Administrators Preface
Table of Contents
1 Introduction............................................................................................................................... 1-0
1.1 Learning Objectives........................................................................................................... 1-1
1.2 MySQL Overview..............................................................................................................1-2
1.2.1 Sun Acquisition.......................................................................................................... 1-2
1.2.2 MySQL Partners.........................................................................................................1-3
1.3 MySQL Products............................................................................................................... 1-4
1.3.1 MySQL Database Products........................................................................................ 1-4
1.3.2 MySQL GUI Tools..................................................................................................... 1-4
1.3.3 Other MySQL Tools................................................................................................... 1-5
1.3.4 MySQL Connectors....................................................................................................1-5
1.3.5 Solutions for Embedding MySQL............................................................................. 1-6
1.4 MySQL Services................................................................................................................ 1-7
1.4.1 MySQL Training........................................................................................................ 1-7
1.4.2 MySQL Certification..................................................................................................1-7
1.4.3 MySQL Consulting.................................................................................................... 1-7
1.4.4 MySQL Support......................................................................................................... 1-7
1.5 The MySQL Enterprise Subscription.................................................................................1-8
1.5.1 MySQL Enterprise Server.......................................................................................... 1-8
1.5.2 24x7 Production Support............................................................................................1-8
1.5.3 MySQL Enterprise Monitor....................................................................................... 1-9
1.5.4 Obtaining a MySQL Enterprise Subscription.......................................................... 1-10
1.6 Supported Operating Systems..........................................................................................1-11
1.7 MySQL Certification Program.........................................................................................1-12
1.8 Training Curriculum Paths...............................................................................................1-13
1.9 MySQL Website...............................................................................................................1-17
1.9.1 MySQL Community Web Page................................................................................1-18
1.9.2 MySQL Online Documentation............................................................................... 1-20
1.10 Installing MySQL.......................................................................................................... 1-23
1.11 Installing the 'world' database........................................................................................ 1-24
1.12 Chapter Summary.......................................................................................................... 1-25
2 MySQL Architecture................................................................................................................. 2-1
2.1 Learning Objectives........................................................................................................... 2-2
2.2 Client/Server Architecture................................................................................................. 2-3
2.2.1 MySQL Server .......................................................................................................... 2-3
2.2.2 Client Programs .........................................................................................................2-3
2.2.3 Communication Protocols..........................................................................................2-4
2.2.4 MySQL Non-Client Utilities ..................................................................................... 2-5
2.3 MySQL Architecture Overview......................................................................................... 2-6
2.3.1 Core Shared Subsystems............................................................................................ 2-6
2.3.2 Query Parsing, Optimization and Execution..............................................................2-8
2.3.3 Query Cache...............................................................................................................2-8
2.3.4 Storage Engine Implementation.................................................................................2-8
2.4 How MySQL Uses Disk Space........................................................................................2-10
2.4.1 Data Directory..........................................................................................................2-10
2.5 How MySQL Uses Memory............................................................................................ 2-13
2.5.1 Memory Allocation Categories................................................................................ 2-13
xiii
MySQL for Database Administrators Preface
xiv
MySQL for Database Administrators Preface
xv
MySQL for Database Administrators Preface
xvi
MySQL for Database Administrators Preface
xvii
MySQL for Database Administrators Preface
xviii
MySQL for Database Administrators Preface
xix
MySQL for Database Administrators Preface
xx
MySQL for Database Administrators Preface
xxi