Documentos de Académico
Documentos de Profesional
Documentos de Cultura
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.
Sun Microsystems, Inc. Disclaimer
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.
Restricted Rights Notice
If this documentation is delivered to the U.S. Government or anyone using the documentation on behalf of the U.S.
Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS
The U.S. Governments rights to use, modify, reproduce, release, perform, display, or disclose these training materials are
restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract.
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.
Preface
iii
Preface
Computer input and output is printed in this format: Computer input or output. This is also used
for the names of executable programs and file locations.
Keywords from the SQL language appear in this format: SQL KEYWORD. SQL keywords are not case
sensitive and may be written in any letter case, but the training guide uses uppercase.
Placeholders for user input inside appearing inside computer input appear in this format: <user input>
When commands are shown that are meant to be executed from within a particular program, the prompt shown
preceding the command indicates which command to use. For example, shell> indicates a command that you
execute from your shell, and mysql> indicates a statement that you execute from the mysql client program:
shell> mysql -u root -h 127.0.0.1
mysql> SELECT * FROM world.City;
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:
mysql> SELECT col_name FROM db_name.tbl_name;
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:
DROP TABLE [IF EXISTS] tbl_name;
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 ]):
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
When one member from a set of choices must be chosen, the alternatives are listed within braces ({ and }):
{DESCRIBE | DESC} tbl_name [col_name | wild]
iv
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:
RESET reset_option[, reset_option] ...
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:
shell> CC=gcc ./configure
If you are using csh or tcsh, you must issue commands somewhat differently:
shell> setenv CC gcc
and
shell> ./configure
Preface
123
vi
NAME
DESCRIPTION
Preparation
Written exam
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
Lab
Student notes
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.
vii
Preface
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.
Install MySQL
Understand views
xi
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
Preface
xiv
Preface
xv
Preface
xvi
Preface
xvii
Preface
xviii
Preface
xix
Preface
xx
Preface
Appendix A
Appendix B
Appendix C
Appendix D
xxi