MySQL 5.0 Certification Study Guide

Similar documents
MySQL Database Administrator Training NIIT, Gurgaon India 31 August-10 September 2015

MySQL for Developers with Developer Techniques Accelerated

ITS. MySQL for Database Administrators (40 Hours) (Exam code 1z0-883) (OCP My SQL DBA)

MySQL for Developers. Student Guide - Volume 1. SQL-4501 Release 2.2. D61830GC10 Edition 1.0 D62436

MySQL for Developers Ed 3

MySQL for Developers Ed 3

CO MySQL for Database Administrators

MySQL for Database Administrators Ed 3.1

Course Outline. MySQL Database Administration & Design. Course Description: Pre-requisites: Course Content:

IT Certification Exams Provider! Weofferfreeupdateserviceforoneyear! h ps://

Model Question Paper. Credits: 4 Marks: 140

T-SQL Training: T-SQL for SQL Server for Developers

MySQL for Developers. Duration: 5 Days

MySQL for Developers. Duration: 5 Days

Course Details Duration: 3 days Starting time: 9.00 am Finishing time: 4.30 pm Lunch and refreshments are provided.

Mastering phpmyadmiri 3.4 for

MySQL for Database Administrators Volume I Student Guide

MySQL for Beginners Ed 3

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS

5. Single-row function

Course Outline and Objectives: Database Programming with SQL

Introduction to Computer Science and Business

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES

MCSA SQL SERVER 2012

Oracle Syllabus Course code-r10605 SQL

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:

ORANET- Course Contents

Oracle Database 10g: Introduction to SQL

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014

20461: Querying Microsoft SQL Server 2014 Databases

20461: Querying Microsoft SQL Server

mysql Certified MySQL 5.0 DBA Part I

MTA Database Administrator Fundamentals Course

DB2 UDB: App Programming - Advanced

Querying Data with Transact-SQL

COPYRIGHTED MATERIAL. Contents. Chapter 1: Introducing T-SQL and Data Management Systems 1. Chapter 2: SQL Server Fundamentals 23.

The SQL Guide to Pervasive PSQL. Rick F. van der Lans

Oracle 1Z0-882 Exam. Volume: 100 Questions. Question No: 1 Consider the table structure shown by this output: Mysql> desc city:

Querying Microsoft SQL Server

MIS NETWORK ADMINISTRATOR PROGRAM

20761B: QUERYING DATA WITH TRANSACT-SQL

COURSE OUTLINE: Querying Microsoft SQL Server

Querying Microsoft SQL Server 2012/2014

Careerarm.com. 1. What is MySQL? MySQL is an open source DBMS which is built, supported and distributed by MySQL AB (now acquired by Oracle)

Ryan Stephens. Ron Plew Arie D. Jones. Sams Teach Yourself FIFTH EDITION. 800 East 96th Street, Indianapolis, Indiana, 46240

Optional SQL Feature Summary

DB2 UDB: Application Programming

AVANTUS TRAINING PTE LTD

Querying Data with Transact-SQL

Course Outline. Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led

SQL Interview Questions

Querying Microsoft SQL Server

20461D: Querying Microsoft SQL Server

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data

After completing this course, participants will be able to:

Querying Data with Transact-SQL

Querying Microsoft SQL Server 2008/2012

20761C: Querying Data with Transact-SQL

Course 20461C: Querying Microsoft SQL Server

COURSE CONTENT. ORACLE 10g/11g DBA. web: call: (+91) / 400,

Chapter 8: Working With Databases & Tables

Duration Level Technology Delivery Method Training Credits. Classroom ILT 5 Days Intermediate SQL Server

Querying Data with Transact-SQL

1Z Oracle. MySQL 5 Database Administrator Certified Professional Part I

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney.

ORACLE DATABASE 12C INTRODUCTION

Oracle 12C DBA Online Training. Course Modules of Oracle 12C DBA Online Training: 1 Oracle Database 12c: Introduction to SQL:

Microsoft Querying Microsoft SQL Server 2014

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led

Querying Microsoft SQL Server

Querying Data with Transact SQL

Querying Data with Transact-SQL

Listing of SQLSTATE values

Querying Microsoft SQL Server (MOC 20461C)

Course Contents of ORACLE 9i

Many-to-Many One-to-One Limiting Values Summary

Oracle Database: Introduction to SQL Ed 2

"Charting the Course to Your Success!" MOC D Querying Microsoft SQL Server Course Summary

Delegates must have a working knowledge of MariaDB or MySQL Database Administration.

Sql Server Syllabus. Overview

Oracle 1Z MySQL 5.6 Database Administrator. Download Full Version :

DB2 SQL Tuning Tips for z/os Developers

Deccansoft softwareservices-microsoft Silver Learing Partner. SQL Server Syllabus

Chapter 9: Working With Data

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Exam 1Z0-061 Oracle Database 12c: SQL Fundamentals

Querying Microsoft SQL Server

Index. Bitmap Heap Scan, 156 Bitmap Index Scan, 156. Rahul Batra 2018 R. Batra, SQL Primer,

Oracle Developer Track Course Contents. Mr. Sandeep M Shinde. Oracle Application Techno-Functional Consultant

Certkiller.A QA

Essential SQLite3. Section Title Page

1Z MySQL 5 Database Administrator Certified Professional Exam, Part II Exam.

Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE

Mysql Information Schema Update Time Null >>>CLICK HERE<<< doctrine:schema:update --dump-sql ALTER TABLE categorie

itexamdump 최고이자최신인 IT 인증시험덤프 일년무료업데이트서비스제공

Certification Exam Preparation Seminar: Oracle Database SQL

Oracle Exam 1z0-883 MySQL 5.6 Database Administrator Version: 8.0 [ Total Questions: 100 ]

Oracle Database 11g: SQL Fundamentals I

Using SQL with SQL Developer 18.2

Backing up or Exporting Databases Using mysqldump

Transcription:

MySQL 5.0 Certification Study Guide Paul DuBois, Stefan Hinz, and Carsten Pedersen MySQC Press 800 East 96th Street, Indianapolis, Indiana 46240 USA

Table of Contents Introduction 1 About This Book 1 Sample Exercises 2 Other Required Reading 2 Manuals ' 3 Sample Data. -...< -_.\_., 3 Study Guide Errata. 3 Certification Information at www.mysql.com 3 The MySQL Certification Candidate Guide,..., 4 i The Certification Mailing List 4 Conventions Used in This Book.:! 4 Running MySQL on Microsoft Windows '.... 6 About the.exams 6 Registering for an Exam 6 Going to the Exam ' '. : 6 Taking the Exam 8 Reading Questions.,,.. 9 Answering Questions 9 After the Exam, 11 Retaking Exams 12 Warning 12 Interpreting DESCRIBE Output '. 12 Sample Tables ' : 14 MySQL Developer Exams MySQL Developer I Exam 1 Client/Server Concepts 21 1.1 General MySQL Architecture, 21 1.2 Invoking Client Programs 22 1.2.1 General Command Option Syntax 23 1.2.2 Connection Parameter Options 24 1.2.3 Using Option Files 28 1.2.4 Selecting a Default Database 30 1.2.5 Establishing a Connection with a GUI Client 31 f 1.3 Server SQL Modes 31 2 The mysql Client Program 35 2.1 Using mysql Interactively 35 jb 2.2 Statement Terminators 38

2.3 The mysql Prompts : 38 2.4 Using Editing Keys in mysqi ^ 39 2.5 Using Script Files with mysqi '. 40 2.6 mysql Output Formats 40 2.7 Client Commands and SQL'Statements 41 2.8 Using Server-Side Help..'. 42 2.9 V Using the --safe-updates Option. 44 3 MySQL Query Browser 45 3.1 MySQL Query Browser Capabilities 45 3.2 Using MySQL Query Browser 46 3.3 Using the Query Window 47 3.3.1 Entering Queries, 48 3.3.2 The Result Area 48 3.3.3 The Script Editor 49 3.3.4 Stored Routine Management 49 3.3.5 The Object and Information Browsers 49 3.4 The MySQL Table Editor 50 3.5 Connection Management 51 3.5.1 Using the Connection Dialog.: 52 3.5.2 Editing Connection Profiles 53 3.6 The Options Dialog.' ; 53 4 MySQL Connectors 55 4.1 MySQL Client Interfaces 55 4.2 MySQL Connector/ODBC 56 4.3 MySQL Connector/J : 56 4.4 MySQL Connector/NET 57 5 Data Types 59 5.1 Data Type Overview 59 5.2 Numeric Data Types 61 5.2.1 Integer Data Types 61 5.2.2 Floating-Point Data Types 62 5.2.3 Fixed-Point Data Types 63 5.3 The BIT Data Type 64 5.4 String Data Types \..' 64 5.4.1 Character Set Support ' 65 5.4.2 Non-Binary String Data Types: CHAR, VARCHAR, TEXT 67 514.3 Binary String Data Types: BINARY, VARBINARY, BLOB -.-.; 69 5.4.4 TheENUM and SET Data Types 69

5.5 Temporal Data Types, 72 : 5.5.1 The DATE, TIME, DATETIME,. and YEAR Data Types.,,.."... 73 5.5.2 The TIMESTAMP Data Type, 74 5.5.3 Per-Connection Time Zone, Support 79 5.6 Column Attributes 82 5.6.1 Numeric Column Attributes...,.,..«. 82 5.6.2 String Column Attributes 83 5.6.3 General Column Attributes ' 83 5.7 Using the AUTO_INCREMENT Column Attribute 84 5.8 Handling Missing or Invalid Data Values 90 5.8.1 Handling Missing Values 91 5.8.2 Handling Invalid Values in Nbri-Strict Mode 92 5.8.3 Handling Invalid Values in Strict Mode 94 5.8.4 Enabling Additional Input Data Restrictions 95 5.8.5' Overriding Input DataRestrictions' 95 6 Identifiers 97 6.1 Identifier Syntax 97 6.2 Case Sensitivity of Identifiers 98 6.3 Using Qualified Names.,..,, 98 6.4 Using Reserved Words as Identifiers.. : 99 7 Databases 103 7.1 Database Properties : 103 7.2 Creating Databases 104 7.3 Altering Databases, 105 7.4 Dropping Databases, 105 7.5 Obtaining Database Metadata 106 8 Tables and Indexes. 109 8.1 Table Properties, 109 8.2 Creating Tables Ill 8.2.1 Creating Tables Using an Explicit Definition 112 8.2.2 Specifying the Storage Engine fora Table 113 8.2.3 Creating Tables Based on Existing Tables 115 8.2.4 Using TEMPORARY Tables.116 8.3 Altering Tables, 117 8.3.1 Adding and Dropping Columns 118 8.3.2 Modifying Existing Columns 119 8.3.3 Renaming a Table 120 8.3.4 Specifying Multiple Table Alterations 120

8.4 Dropping Tables, 120 8.5 Emptying Tables 121 8.6 Indexes. 122 8.6.1 Types of Indexes.: 122 8.6.2 Creating Indexes i, 122 8.6.3 Choosing an Indexing Algorithm < 128 8.7 Dropping Indexes.-..., 129 8>8 Obtaining Table and Index Metadata 130 9 Querying for Data 135 9.1 Using SELECT to Retrieve Data 135 9.2 Specifying Which Columns to Retrieve...' 136 9.2.1 Renaming Retrieved Columns 137 9.2.2 Identifying the Database Containing a Table 138 9.3 Specifying Which Rows to Retrieve ' 139 9.3.1 Using ORDERBY to Sort Query Results 140 9.3.2 The Natural Sort Order of Data Types..." 143 9.3.3 Limiting a Selection Using LIMIT 146 9.3.4 Using DISTINCT to Eliminate Duplicates 148 9.4 Aggregating Results 150 9.4.1 The MINO and MAX() Aggregate Functions 151 9.4.2 The SUMO and AVCO Aggregate Functions 152 9.4.3 The COUNTO Aggregate Function 152 9.4.4 The CROUP_CONCAT() Function...-...'. 153 9.4.5 Aggregation for NULL Values or Empty Sets 155 9.5 Grouping Results " 156 9.5.1 CROUP BY and Sorting 160 9.5.2 Selecting Groups with HAVING ' 160 9.5.3 Using CROUPBY and WITH ROLLUP 161 9.6 Using UNION.'...- 165 TO SQL Expressions 167 10.1 Components of SQL Expressions.. 167 10.2 Numeric Expressions ; 169 10.3 String Expressions.., 170 10.3.1 Case Sensitivity in String Comparisons 171 10.3.2 Using.LIKE for Pattern Matching 176 10.4 Temporal Expressions 179 10.5 NULL Values.,.,..,: 180 "10.6 Functions in SQL Expressions 181 10.6.1 Comparison Functions, 182 10.6.2 Control Flow Functions 184

Content's- 10.6.3 Aggregate Functions ; 185 10.6.4 Mathematical Functions 186 10.6.5 String Functions 188 10.6.6 Temporal Functions ; 189 10.6.7 NULL-Related Functions...;..., 191 10.7 Comments in SQL Statements,... :.'.. 192 11 Updating Data 193 11.1 Update Operations 193 11.2 The INSERT Statement :....\.'...'...";., 194 11.2.1 Adding Multiple Records with a Single INSERT Statement -., 196 11.2.2 Handling. Duplicate Key Values 197 11.2.3 Using INSERT... ON DUPLICATE < KEY UPDATE, 198 11.3 The REPLACE Statement 199 11.4 The UPDATE Statement, 201 11.4.1 Using UPDATE with ORDER BY and LIMIT 203 11.4.2 Preventing Dangerous UPDATE Statements 204 11.4.3 Multiple-Table UPDATE Statements... 204 11.5 The DELETE and TRUNCATE TABLE Statements.,, 204 11.5.1 Using DELETE with ORDER BY and LIMIT 205 11.5.2 Multiple-Table DELETE Statements 205 11.6 Privileges Required for Update Statements 206 MySQL Developer II Exam 12 Joins. 209 12.1 Overview r -... 209 12.2 Writing Inner Joins c- ;. 210 12.2.1 Writing Inner Joins with the Comma Operator 210 12.2.2 Writing Inner Joins with INNER JOIN 217 12.3 Writing Outer Joins 217 12.3.1 Writing LEFT JOIN Queries '. 218 12.3.2 Writing RIGHT JOIN Queries '" 221 12.4 Resolving Name Clashes Using Qualifiers and Aliases :..' '..'...' 222 ''. 12.4.1 Qualifying Column Names 222 12.4.2 Qualifying and Aliasing Table Names..' 224 12.5 Multiple-Table UPDATE and DELETE Statements 225 A t - y 13 Subqueries 227 13.1 Types of Subqueries, 227 ^ 13.2 Subqueries as Scalar Expressions 228

13.3 Correlated Subqueries 229 13.4 Comparing Subquery Results to Outer Query Columns 230 13.4.1 Using ALL-, ANY, and SOME...;.. 230 1 13.4.2 Using IN, :... 234 13.4.3 Using EXISTS 235 13.5 Comparison Using Row Subqueries 236 13.6 Using Subqueries in thefrom Clause. 237 13.7 Converting Subqueries to Joins 238 13.7.1 Converting Subqueries to Inner Joins 238 13.7.2 Converting Subqueries to Outer Joins 240 13.8 Using Subqueries in Updates 241 14 Views 243 14.1 Reasons to Use Views 243 14.2 Creating Views 244 14.2.1 Restrictions on Views. -.,.; 247 14.2.2 View Algorithms. 248 14.2.3 Updatable Views. ; 250 14.3 Altering Views.'... 253 14.4 Dropping Views 253 14.5 Checking Views 254 14.6 Obtaining View Metadata 254 14.7 Privileges Required for Views ; 256 15 Importing and Exporting Data 257.15.1 Import and Export Operations 257 15.2 Importing and Exporting Using SQL, 258 15.2.1 Importing Data with LOAD DATA INFILE 258 15.2.2 Exporting Data with SELECT... INTO OUTFILE, 264 15.2.3 Data File Format Specifiers 265 15.2.4 Importing and Exporting NULL Values 267 15.3 Importing and Exporting Data from the Command Line 267 15.3.1 Importing Data with mysqiimport 267 15.3.2 Exporting Data with mysqidump 270 16 User Variables 273 16.1 User Variable Syntax. /. 273 16.2 User Variable Properties 274 17^Prepared Statements 275 17.1 Benefits of Prepared Statements 275 17.2 Using Prepared Statements from the mysqi Client 275

17.3 Preparing a Statement.-.*.' ' 276 17.4 Executing a Prepared-Statement 277 J 7.5 Deallocating Prepared Statements.-.:.. 279 18 Stored Procedures and Functions 281 18.1 Benefits of Stored Routines 282 18.2 Differences Between Stored Procedures and Functions 283 18.3 The Namespace for Stored Routines! 284 18.4 Defining Stored Routines 284 18.5 Creating Stored Routines 285 18.5.1" Compound Statements 287 18.5.2 Declaring Parameters 289 18.5.3 The DECLARE Statement '/ 291 18.5.4 Variables in Stored Routines '... 291 18.5.5 Conditions and Handlers 292 18.5.6 Cursors..,.,..'..,. 295 18.5.7 Retrieving Multiple Result Sets.-...' 297 18.5.8 Flow Control.,', 298 18.6 Altering Stored Routines... :.:..'... 302 18.7 Dropping Stored Routines.- :.' 303 18.8 Invoking Stored Routines 303 18.9 Obtaining Stored Routine Metadata.' 304 18.10 Stored Routine Privileges and Execution Security 305 19 Triggers 307 19.1 Reasons to Use Triggers ; 307 1.9.2 Trigger Concepts '. 308 19.3 Creating a.trigger :.' 309 19.4 Restrictions on Triggers 311 19.5 Referring to Old and New Column Values 311 19.6 Destroying a Trigger 311 19.7 Privileges Required for Triggers 312 20 Obtaining Database Metadata 313 20.1 Overview of Metadata Access Methods 313 20.2 Using INFORMATION_SCHEMA to Obtain Metadata 314 20.3 UsingSHOW and DESCRIBE to Obtain Metadata 317 20.4 Using mysqtshow to Obtain Metadata 322 21 Debugging MySQL Applications 325 jc f 21.1 Interpreting Error Messages 325 21.2 The SHOW WARNINGS Statement 326

21.3 The SHOW ERRORS Statement..:...:. 329 21.4 The perror Utility ' : ^..; 329 22 Basic Optimizations 331 22.1 Overview of Optimization Principles 331 22.2 Using Indexes for Optimization 332 22.2.1 Types of Indexes. 332 22.2.2 Principles for Index Creation 333 22.2.3 Indexing Column Prefixes ' 334 22.2.4 Leftmost Index Prefixes 335 22.3 General Query Enhancement 337 22.3.1 Queiy Rewriting Techniques 337 22.3.2 Using EXPLAIN to Obtain Optimizer Information 338 22.3.3 Optimizing Queries by Limiting Output 339 22.3.4 Using Summary Tables : ' 340 22.3.5 Optimizing Updates. 343 22.4 Choosing Appropriate Storage Engines * 344 22.5 Normalization 345 MySQL DBA Exams MySQL DBA I Exam 23 MySQL Architecture 351 23.1 Client/Server Overview ' 351 23.2 Communication Protocols... 352 23.3 The SQL Parser and Storage Engine Tiers 354 23.4 How MySQL Uses Disk Space 355 23.5 How'MySQL Uses Memory.: 355 24 Starting, Stopping, and Configuring MySQL 359 24.1 Types of MySQL Distributions 359 24.1.1 MySQL Binary Distributions 360 24.1.2 MySQL Source Distributions 360 24.2 Starting and Stopping MySQL Server on Windows 361 24.2.1 Server Startup Prerequisites on Windows 361 24.2.2 Running MySQL Server Manually on Windows 363 24.2.3 Running MySQL Server as a Windows Service 364 24.3 Starting and Stopping MySQL Server on Unix 365 jf 24.3.1 Server Startup Prerequisites on Unix 365 24.3.2 Choosing a Server Startup Method on Unix 367

24.4 Runtime MySQL Configuration \.. i 368 24.5 Log and Status Files..'. 372 24.5.1 The General Query Log, 373 24.5.2 The Binary Log..,.., 373 24.5.3 The Slow Query Log. 374 24.5.4 The Error Log 374 24.5.5 Status Files 375 24.6 Loading Time Zone Tables 375 24.7 Security-Related Configuration 376 24.8 Setting the Default SQL Mode, 377 24.9 Upgrading MySQL 377 25 Client Programsfor DBA Work, 379 25.1 Overview of Administrative Clients 379 25.2 MySQL Administrator 380 25.3 mysql., 381 25.4 mysqiadmin '. 381 25.5 mysqlimport 382 25.6 mysqldump 382 25.7 Client Program Limitations 383 26 MySQL Administrator 385 26.1 MySQL Administrator Capabilities 385 26.2 Using MySQL Administrator 386 26.2.1 Starting MySQL Administrator 386 26.2.2 Selecting an Operational Mode 387 26.3 Server Monitoring Capabilities 388 26.3.1 Server Information 389 26.3.2 Server Connections. : 389 26.3.3 Health,, 389 26.3.4 Server Logs '..., 390 26.3.5 Replication Status 390 26.3.6 Catalogs 390 26.4 Server Configuration 391 26.4.1 Service Control 391 26.4.2 Startup Variables 392 26.4.3 User Administration 392 26.5 Backup and Restore Capabilities 393 26.5.1 Making Backups 393 26.5.2 Restoring Backups 394 26.6 MySQL Administrator System Tray Monitor 394

I Contents 27 Character Set Support ' i 395 27.1 Performance Issues ^ 395 27.2 Choosing Data Types.for Character Columns.:.396 28 Locking.. ' 399 28.1 Locking Concepts - 399 28.2 Explicit Table Locking..:.,... 401 28.3 Advisory Locking....-.-,. ; 403 29 Storage Engines 405 29.1 MySQL Storage Engines :.:..- 405 29.2 The MylSAM Engine ; 408 29.2.1 MylSAM Locking Characteristics...' 409 29.2.2 MylSAM Row-Storage Formats..'..'.., 411 29.3 The MERGE Engine 412 29.3.1 MERGE Locking Characteristics,..-..':. 414 29.4 The InnoDB Engine.,,.,..-..;.,..,...- 414 29.4.1 The InnoDB Tablespace and Logs 415 29.4.2 InnoDB and ACID Compliance 416 '- 29.4.3 The InnoDB Transaction Model 416 29 A A InnoDB Locking Characteristics 418 29.4.5 InnoDB Isolation Levels, Multi-Versioning, and Concurrency 420 29.4.6 Using Foreign Keys 422 29.4.7 Configuring and Monitoring InnoDB 426 29.5 TheMEMORY Engine : 432 29.5.1MEMORY Indexing Options 433 29.6 The FEDERATED Engine, 433 29.7 The Cluster Storage Engine 435 29.8 Other Storage Engines '.'. 436 30 Table Maintenance 437 30.1 Types of Table Maintenance Operations-. 437 30.2 SQL Statements for Table Maintenance. 438 30.2.1 CHECK TABLE 439 30.2.2 REPAIR TABLE 439 30.2.3 ANALYZE TABLE 439 30.2.4 OPTIMIZE TABLE, 439 30.3 Client and Utility Programs for Table Maintenance 440 g 30.3,1 The mysql check Client Program 440 3.0.3.2 The myisamchk Utility..,...'!...,.. 441 30.3.3 Options for mysql.check and myisamchk 442

30.4 Repairing InnoDB Tables '... \.\...-, 443 30.5 Enabling MylSAM Auto-Repair, i 444 31 The INFORMATION_SCHEMA Database ' 447 : 31.1 INFORMATION_SCHEMA Access Syntax 447 31.2 INFORMATION_SCHEMA Versus SHOW..;. 449 31.3 Limitations of INFORMATION_SCHEMA ;.... 450 32 Data Backup and Recovery Methods 451 32.1 Introduction.:..,..'...- 451 32.2 Binary Versus Textual Backups..., : 452 32.3 Making Binary Backups '. 453 32.3.1 Making Binary MylSAM Backups...: 453 32.3.2 Making Binary.InnoDB Backups, 454 32.3.3 Other Binary Backup Tools...; 455 32.3.4 Conditions for Binary Portability '.. 456 32.4 Making Text Backups,..,.-........ 457 32.4.1 Making Text Backups via.sql 457 32.4.2 Making Text Backups with.mysqidump 457 32.4.3 Making Text.Backups, with MySQL Administrator 461 32.5 Backing Up Log and Status*Files... 461 32.6 Replication as an Aid to Backup 462 32.7 MySQL Cluster as Disaster Prevention 462 32.8 Data Recovery 462 32.8.1 Reloading mysqldump Output.. : 463 32.8.2 Reloading Dumps with MySQL Administrator 464 32.8.3 Processing Binary Log Contents...'.. 464 33 Using Stored Routines and Triggers for Administration 469 33.1 Using Stored Routines and Triggers for Security Purposes 469 33.2 Using Stored Routines to Enhance Performance 471 MySQL DBA II EXAM 34 User Management ' 473 34.1 User Account Management 473 34.1.1 Types of Privileges That MySQL Supports 474, 34.1.2 The Grant Tables..' 476 34.1.3 Approaches to Account Management 477 3'4.1.4 Creating and Dropping User Accounts 478.. f 34.1.5 Specifying Account Names 478 34.1.6 Granting Privileges 480 34.1.7 Revoking Privileges 482

34.1.8 Changing Account Passwords :. 484 34.1.9 When Privilege Changes Take Effect 484 34.1.10 Specifying Resource Limits, 485 34.1.11 Privileges Needed for Account Management 485 34.2 Client Access Control 486 34.2.1 Connection Request Checking 488 34.2.2 Statement Privilege Checking' 489 34.2.3 Resource Limit Checking' ' 490 34.2.4 Disabling Client Access Control 490 35 Securing the MySQL Installation 491 35.1 Security Issues 491 35.2 Operating System Security 492 35.3 Filesystem Security 493 3 5.4 Log Files and Security 495 35.5>Network Security 496 35.5.1 Securing the Initial MySQL Accounts 496 35.5.2 General Privilege Precautions 498 35.5.3 MySQL Cluster Network Security 499 35.6 FEDERATED Table Security 500 36 Upgrade-Related Security Issues 501 36.1 Upgrading the Privilege Tables 501 36.2 Security-Related SQL Mode Values 502 37 Optimizing Queries 505 37.1 Identifying Candidates for Query Analysis ; 505 37.2 Using EXPLAIN to Analyze Queries 507 37.2.1 How EXPLAIN Works : 507 37.2.2 Analyzing a Query 509 37.2.3 EXPLAIN Output Columns 514 3.7.3 UsingSHOW WARNINGS for Optimization 519 37.4 MylSAM Index Caching 519 38 Optimizing Databases 523 38.1 General Table Optimizations 523 38.2 Normalization 525 38.3 MylSAM-Specific Optimizations ' 531 38.3.1 MylSAM Row-Storage Formats 532 38.3.2 Keep Optimizer Information Up to Date 537 $ 38.3.3 FULLTEXT Indexes 537 38.3.4 Specifying MylSAM Maximum Row Count 539 38.4 InnoDB-Specific Optimizations 541

38.5 MERGE-Specific Optimizations :..'.... 542 38.6 MEMORY-Specific Optimizations.'. 543 39 Optimizing the Server 545 39.1 Interpreting mysqld Server Information 545 39.1.1 Accessing Server System Variables 546 39.1.2 Accessing.Server Status Variables, 549 39.2 Measuring Server Load 552 39.3 Tuning Memory Parameters 553 39.3.1 Global (Server-Wide) Parameters 554 39.3.2 Per-Client Parameters '...- 558 39.4 Using the Query Cache 559 39.4.1 Enabling the Query Cache, ',..'.; 560 39.4.2 Measuring Queiy Cache Utilization 561 40 Interpreting Diagnostic Messages 563 40.1 Sources of Diagnostic Information 563 40.2 Using the Error Log for Diagnostic Purposes' 563 40.3 Using The Slow Query Log for Diagnostic Purposes 564 41 Optimizing the Environment, 567 41.1 Choosing Hardware for MySQL Use 567 41.2 Configuring Disks for MySQL Use ' 568 41.2.1 MovingJJatabases Using Symbolic Links 569 41.2.2 MylSAM Table Symlinking "..'...'. 570 41.3 Network Issues : 572 41.4 Optimizing the Operating System for MySQL Use 572 42 Scaling MySQL ' 575 42.1 Using Multiple Servers 575 42.2 Replication.",...: ' 577 42.2.1 Setting Up Replication., 578 42.2.2 The Binary and Relay Logs, : 580 42.2.3 Replication-Related Threads.." 581 42.2.4 Replication Troubleshooting '.:..-..-. 583 42.2.5 Replication Compatibility and Upgrading 583 Appendixes A References 587 B Other Offers 589 >' Index 591