1. Trang chủ
  2. » Công Nghệ Thông Tin

MySQL Administrator''''s Bible- P18

41 324 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề MySQL Administrator's Bible
Trường học MySQL Community
Chuyên ngành Database Management
Thể loại essay
Năm xuất bản 2025
Thành phố unknown
Định dạng
Số trang 41
Dung lượng 2,68 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

for-■ MySQL GUI Tools documentation ■ Expert Guides for internals, the Cluster API, and the test framework ■ The sakila, world, employee, and menagerie example databases ■ Community cont

Trang 1

Resources C

■ Wiki (http://forge.mysql.com/wiki/Main Page) — Anyone can create and edit pages to share knowledge Current information on the wiki includes conference presenta- tions, user-contributed documentation, articles, tutorials, and specifications.

Getting Documentation

The official documentation for MySQL is online athttp://dev.mysql.com/doc It includes links to:

■ The comprehensive MySQL Reference Manual, for downloading or online viewing The

reference manuals for MySQL 5.0 and 5.1 have been translated into several different mats and languages Visithttp://dev.mysql.com/doc/#refmanto see a matrix of the documentation available.

for-■ MySQL GUI Tools documentation

■ Expert Guides for internals, the Cluster API, and the test framework

■ The sakila, world, employee, and menagerie example databases

■ Community contributed documentation

■ Documentation about the MySQL documentation

At the time of this writing, the official reference manual for MySQL 6.0 is only available in English, and can be viewed online at http://dev.mysql.com/

doc/refman/6.0/en/index.html or downloaded from the main documentation site at http://dev.mysql.com/doc/#refman.

Cheat sheets and quick references

■ MySQL 6.0 function and statement cheat sheets (www.visibone.com/sql/) — From VisiBone, full-color quick-reference guides to all of the MySQL functions and state- ments Available for free download or purchase laminated pages or posters Indicates whether a function or statement is part of the ISO/ANSI SQL:2003 standard.

■ EXPLAINcheat sheet (cheatsheet) — Developed by author Sheeri K Cabral with formatting help from Dave Edwards, theEXPLAINcheat sheet is a freely downloadable reference for quick or offline lookup of what the different fields of output fromEXPLAINmeans

http://www.pythian.com/blogs/960/explain-■ Common DBA tasks cheat sheet (http://en.wikibooks.org/wiki/MySQL/

CheatSheet) — From Wikibooks, a cheat sheet containing commands for sample queries, metadata access, privilege administration, data types, resetting the root password, and more.

■ Metadata access comparison (http://sqlzoo.net/howto/source/z.dir/

i12meta.xml) — Shows how to access metadata such as table names, column names, and the software version in many vendors’ DBMS, including MySQL A similar cheat

Trang 2

■ Planet MySQL (www.planetmysql.org) — An aggregated feed of blog posts from the MySQL Community The top 30 most active contributors are highlighted, so if you prefer you can follow the links and choose to follow a few individual blogs.

■ MySQL Magazine (www.mysqlzine.net) — Edited by Keith Murphy, MySQL zine’s inaugural issue appeared in the summer of 2007 MySQL Magazine is produced four

Maga-times annually, with current and back issues freely available online as printable PDFs.

■ MySQL Developer Zone articles (http://dev.mysql.com/tech-resources/articles) and news (http://dev.mysql.com/tech-resources/news) — Collec- tions of tech news and articles from and for MySQL developers

■ MySQL Newsletter (www.mysql.com/news-and-events/newsletter) — The monthly newsletter ‘‘with articles about new products, new features, training, security issues, known bugs, and events of interest to the MySQL community.’’ Current and back issues are freely available online.

■ MySQL White Papers (www.mysql.com/why-mysql/white-papers) — White papers about MySQL.

■ Sun’s list of MySQL Resources for System Administrators (www.sun.com/bigadmin/topics/mysql) — Sun’s BigAdmin System Administration Portal contains a section on MySQL resources for system administrators.

■ HowToForge articles (www.howtoforge.com/howtos/mysql) — How To articles for MySQL tasks.

Presentations

There are many resources for seeing presentation slides and videos available:

■ MySQL presentations from before 2007 (resources/presentations/) — Presentations from conferences before 2007

http://dev.mysql.com/tech-■ Presentations from the 2007 MySQL User Conference and Expo (www

presentations-and-videos) — A comprehensive list of presentations, slides, notes, and videos from the 2007 MySQL User Conference and Expo

Trang 3

technocation.org/content/2007-mysql-user-conference-and-expo-Resources C

■ Presentations from the 2008 MySQL User Conference and Expo (http://

forge.mysql.com/wiki/MySQLConf2008Notes) — A comprehensive list of presentations, slides, notes, and videos from the 2008 MySQL User Conference and Expo

■ Presentations from the 2009 MySQL User Conference and Expo (http://forge.mysql.com/wiki/MySQLConf2009Notes) — A comprehensive list of presentations, slides, notes, and videos from the 2009 MySQL User Conference and Expo

The MySQL Forge Wiki (http://forge.mysql.com/wiki) will link to future ferences, so make sure to look there.

con-■ MySQL live webinars (www.mysql.com/news-and-events/web-seminars) — MySQL offers free live Webex webinars containing technology overviews

■ MySQL on-demand webinars (webinars/) — MySQL makes the most popular live webinars available for playback any time

www.mysql.com/news-and-events/on-demand-■ MySQL University (http://forge.mysql.com/wiki/MySQL University) — depth technical sessions given by leading MySQL developers and community members

In-■ MySQL presentations at Technocation (http://technocation.org/category/areas/presentationsvideos) — Technocation, Inc is a not-for-profit organization providing educational resources for IT professionals They host many video presentations and provide slides that can be freely downloaded or streamed for viewing online.

■ Popular video hosting sites — YouTube and Google Video are the most popular video sharing sites in the United States However, there are many more video-sharing sites, and most have search capabilities Simply searching for ‘‘mysql’’ on a video-sharing site can turn up presentations and video tutorials about MySQL.

■ YouTube MySQL videos (www.youtube.com/results?search query=mysql)

— YouTube limits video uploads to 10 minutes, so the videos returned by this search are usually short The exception is videos on YouTube that come from Google Video.

■ Google Video MySQL presentations (http://video.google.com/videosearch?q=mysql) — Do a basic search for videos containing the keyword ‘‘mysql’’.

User group meetings

There are MySQL user groups throughout the world Information about starting a user group as well as what user groups currently exist can be found athttp://forge.mysql.com/wiki/

Category:MySQLUserGroups.

Conferences

Conferences are an excellent place to see live presentations about MySQL and provide nities to meet other MySQL DBAs while learning.

Trang 4

opportu-C Resources

■ MySQL Conference and Expo (www.mysqlconf.com) — Traditionally held in April

in Santa Clara, California, the MySQL Conference and Expo is the premier conference for learning about MySQL and networking with other MySQL users.

■ OSCon (http://conferences.oreillynet.com/oscon/) — OSCon, or the Open Source Convention, is traditionally held during July in Portland, Oregon There are usu- ally several MySQL-related presentations.

■ Various camps — MySQL Camp is a free unconference for MySQL, held annually As

MySQL Camp is organized by the MySQL Community and is not a commercial event, the date and location changes often MySQL Camp dates will be announced in many places, including Planet MySQL blogs (http://planetmysql.org) OpenSQL Camp (www.opensqlcamp.org) is a free unconference for open source databases, including MySQL.

Training/certification

The training and certification opportunities that MySQL offers are listed atwww.mysql.com/training MySQL maintains a list of third-party partners offering training athttp://

solutions.mysql.com/solutions/partners/training.

Trang 7

\ (backslash)escape characters, 91–93naming limitations and quoting, 93–94 (dot), 95–97

” (double quotation mark)

naming limitations and, 93SQL mode definitions, 204

vs 64-bit systems, 12choosing hardware, 349–350

\! command, 6264-bit systems

vs 32-bit systems, 12choosing hardware, 349–350

OS architecture, 352

A

abstraction, view, 307–308

access See also security

data access strategy, 596–606database, 654

user account problems, 491

Access Control Lists (ACLs) See ACLs (Access Control

Lists)accessing MySQLAdministrator, 74–80command-line client tool, 52–62with command-line tools, 49–52

mysqladmin, 62–66phpMyAdmin, 69–71Query Browser, 71–74SQLyog, 66–69summary, 83–84Workbench, 80–83accounts, userdebugging problems, 490–494managing, 478–487

ACID (atomicity, consistency, isolation and durability)

compliancedefined, 319–320PBXT, 410understanding, 320–322ACLs (Access Control Lists)defined, 474–475securing MySQL, 649–653security with stored routines, 256activity logging, 520–522

administrationAdministrator tool, 74–80

log See logs measuring performance See performance measurement

with mysqladmin, 62–66

server tuning See MySQL server tuning storage engine See storage engines user management See user management

agent-based systems, 635–636agentless systems, 635–636aggregate functionsNULL values and, 211overview, 783–784

alerts, monitoring See monitoring systems

algorithmsMyISAM index buffer, 366partitioning, 496–497view, 309–310aliases

creating trigger, 244extension, 115table, 592–594ALLOW_INVALID_DATES, 204

Trang 8

A Index

alpha releases, 11–12ALTER EVENT, 295–296ALTER ROUTINE, 270–271ALTER TABLE

adding/dropping indexes, 223–225adding/dropping partitions, 507–509creating/dropping key constraints, 231–237defined, 421

extensions, 115–118ALTER VIEW, 316–317ANALYZE TABLEdefined, 156query analysis, 615

analyzing queries See query analysis

anonymous userscreating, 35–36removing, 39ANSI, 204ANSI QUOTES, 204Apache, 360API (Application Programming Interface)memcached programming libraries, 436security with stored routines, 256

Apple OS See Mac OS

Application Programming Interface (API)memcached programming libraries, 436security with stored routines, 256application-level partitioning, 514architecture

Falcon, 402–403

high availability See high availability architectures

operating system, 352–353PBXT, 410–411

Archivebacking up, 462–463understanding, 417–419archive packages, 18–20arguments

bitwise operators, 784–787INOUT to stored procedure, 261–262Lua basics, 758–759

mysqladmin, 62–66stored routines, events and triggers, 242arithmetic MySQL Proxy tokens, 773articles on MySQL, 818

assertions, 108asynchronous replicationdefined, 524–525multi-master, 538–539atomicity, 321

atomicity, consistency, isolation and durability (ACID)

compliance See ACID (atomicity, consistency,

isolation and durability) complianceattributes

binary data types, 171changing events, 296character string type, 164–166datetime type, 191–192ENUM and SET data types, 198–200national character string types, 167numeric type, 177–180, 181–182auditing, trigger-based, 664–665authentication

data security, 656–665lack of client support, 491–492

managing user See user management privileges See privileges

AUTO_INCREMENTmaster/master replication, 537, 735numeric type attributes, 177–178table definition extensions, 147autocommit mode, 157, 324–325auto-completion

mysql commands, 58–59SQLyog, 67

auto-generated data, 551automated failoverdefined, 729with Linux-HA heartbeat, 742–744with MySQL Proxy, 740–741

automated monitoring See monitoring systems

automated startup, 42automatic updates, 187–188Axmark, David, 4

B

backendschanging query, 763–764MySQL Proxy, 751–755backslash (\)

escape characters, 91–93naming limitations and quoting, 93–94backup

commercial options, 464–467comparing storage engines, 377–378copying databases, 467

event, 300file system snapshot, 451–452frequency, 443–444

LVM, 455–460maatkit parallel dump/restore, 450–451

Trang 9

Index C

methods, 445–446MySQL, 439–441mysqldump, 446–450mysqlhotcopy, 462–463online, 460–462

phpMyAdmin, 70SAN and Microsoft VSS, 460security, 656

SELECT INTO OUTFILE, 450simple replication, 530–531SQL Administrator, 79stored routine, 286–287summary, 472

trigger, 252–254uses for, 441–443what to and where to, 445ZFS, 453–454

bad passwords, 490–491batching

executing non-interactively, 54–55expensive operations, 628–629frequent operations, 629–631battery-backed write cache, 351BEGIN, 322

BEGIN WORK, 322benchmarkingdefined, 545–546with mysqlslap, 547–552overview, 546–547recommendations, 565–566

with SysBench See SysBench

Best Support For Multilingualism, 35beta releases, 11–12

binary collationscharacter string type attributes and, 165defined, 98

binary file vs source code, 10binary large object string types, 168–170binary logs

backing up, 445crash recovery, 468–471defined, 518–519master/master replication and, 736rotating, 522–524

binary MySQL Proxy distributions, 750–751binary packages, 20–24

binary plug-ins, 415bin-log, 732BIT

NULL and, 784sizes and ranges, 173–174

bitwise operators, 784–787black box queries, 255–256Blackhole

complex replication, 536replication support, 527understanding, 419–420blank values, 650

BLOBdata types, 168–170indexing, 226–227block devices, 738–739blogging, 6

bogging down, 585Boolean types, 180–183Bouman, Roland, 716, 744BTREE indexes

defined, 221–222order, 225–226redundant, 231types, 228–229buffer pools, 579buffers

defined, 356–357InnoDB configuration, 385InnoDB status, 389InnoDB storage engine options, 367–369MyISAM, 365–366

profiling, 574storage engine support, 377–378

bugs See also debugging

BIT_AND NULL, 784reports, 816building queries, 67–69

C

CA (Certificate Authority)command-line tool options, 53encrypted connectivity, 662cache hit ratio, 365–366caching

implementing tables, 424–427memcached, 434–438overview, 423–424PBXT configuration, 412profiling, 576–577query cache, 427–434scaling with memcached, 747summary, 438

Cacti, 637–638CALL, 259–260

Trang 10

C Index

Callaghan, Mark, 525canceling queries, 59–60capacity planning, 585cardinality, index, 615CASCADE, 234cascading replication, 535–536CASE, 282–283

case-sensitivitybinary collations, 98escape characters, 92Falcon tablespace, 409language structure, 90–91query cache, 428CAST

data types for, 811defined, 102–105MySQL support, 107catalogs

managing with Administrator,80

MySQL support, 107

object See object catalog

catch-all partitions, 499Certificate Authority (CA)command-line tool options, 53encrypted connectivity, 662certificate files, 661–662certification, MySQL, 820CHANGE MASTER, 534changelogs, 45–46changingevents, 295–296injecting queries and, 764–766MERGE tables, 512–513query backend, 763–764stored routines, 270–271triggers, 246–247views, 316–317CHAR, 160–162character objectscharacter string types, 160national character string types, 166Character Set screen, 35

character setsALTER TABLE extensions, 116changing event, 299

changing stored routine, 264changing trigger, 249–250character string type attributes and, 165–166defined, 98–105

MySQL support, 108

SHOW commands, 136–137table definition extensions, 147CHARACTER_SETS, 695–696characters

bit functions, 786case-sensitivity, 90–91escape, 91–93index length, 226–228Lua basics, 757national string types, 166–168sets and collations, 98–105string types, 160–166wildcards, 475–476cheat sheets, 817–818check constraintsMySQL deviations, 111–112simulating in views, 310–312CHECK TABLE, 150–153checksums

correcting data drift, 540–542table definition extensions, 147–148table maintenance extensions, 156child tables, 234

chilling, 406ciphers, 53circular replicationdefined, 537–539scaling with, 736–737cleanup

I/O test mode, 556–557OLTP test mode, 563–565SysBench commands, 553clear command

defined, 59mysqladmin, 63client tool

MySQL access, 52–62setting characters sets and collation, 103closing cursors, 287

Cluster, MySQL See MySQL Cluster

COALESCE PARTITION, 508–509code

language structure See language structure

in MySQL community, 7source, 4

source vs binary file, 10coercibility, 810–811cold backupsdefined, 441location, 445tools, 446

Trang 11

Index C

COLLATION_CHARACTER_

SET_APPLICABILITY, 696–697COLLATIONS, 696

collationschanging event, 299changing stored routine, 264changing trigger, 249–250character string type attributes and, 165–166language structure, 98–105

MySQL support, 108SHOW commands, 137table definition extensions, 148COLUMN_PRIVILEGES, 712–713COLUMNS, 676–679

columnsALTER TABLE extensions, 118privileges, 482

SHOW commands, 137stored routine warning, 257–259Comma Separated Value (CSV), 420–421COMMAND in PROCESSLIST, 699–700command-line tools

accessing MySQL with, 49–52binary log, 519

client tool, 52–62Maria, 401memcached, 435mysqladmin, 62–66proxy script behavior, 759starting and stopping MySQL as service, 27starting and stopping MySQL from Windows, 25–26table maintenance, 154

using with Query Browser, 73commands

events See events

FLUSH TABLES WITH READ LOCK, 452

INFORMATION_SCHEMA database system view See

MySQL Data DictionaryLVM, 455–460

MySQL deviations See deviations

mysqlhotcopy, 462–463

vs options, 56partitioning, 507–510

replication See replication

rotating logs, 522–523SHOW, 136–147SHOW ENGINE InnoDB STATUS, 385–390SHOW ENGINE PBXT STATUS, 414–415storage engine, 421–422

SysBench, 553table maintenance extensions, 150–156

transactional statement extensions, 156–158

triggers See triggers

user management, 478–487comments

applying to events, 295language structure, 88–90Lua, 757

stored routine options, 266table definition extensions, 148commercial backup options, 464–467commercial monitoring systems, 644–646COMMIT

defined, 322extensions, 156–158community, 6–7compactor threads, 411company background, 4–5comparison operatorsdefined, 789–791MySQL support, 106–107compilation

plugin, 722–723SysBench, 565Complete installation, 21–22Complete package, 21complex replication, 534–539composite INTERVAL units, 801–802composite keys, 220

composite partitioningdefined, 497working with, 504–507compound foreign key constraints, 232compression

Archive, 417–418command-line tool options, 53commercial backup options, 466–467functions, 788–789

ibbackup, 464with myisampack, 381–382concatenation, 107

concurrencyConcurrent Connections screen, 34multi-version control, 335MyISAM, 378–379MyISAM inserts, 379–380conditions, stored routine, 275–281conferences, 819–820

configurationArchive, 417–419Configuration Wizard on Windows, 31–36CSV, 420–421

Trang 12

C Index

configuration (continued)

encrypted connectivity, 663Falcon, 403–409

FEDERATED storage engine, 415–417initial MySQL, 29–31

InnoDB variables, 384–386Maria, 396–401

memcached, 435MEMORY, 395–396MyISAM, 380MySQL Proxy backends, 751–755PBXT, 411–414

post-install on Unix, 36–39query cache, 429–433replication, 529–539securing, 40–41slave promotion, 732Windows PATH variable, 42–44

configuration files See option files

Confirmation screenconfiguration options, 36defined, 24

connection pooling, 746–747connections

changing query backend, 763–764command-line tool options, 51–52debugging account problems, 492encrypted, 659–664

health monitoring, 78memcached, 437MySQL deviations, 109MySQL Proxy backends, 751–755mysqladmin commands, 63–64profiling, 577–578

Query Browser, 72–73securing operating systems, 654–655server maintenance extensions, 130SQL Administrator, 76

SQLyog, 66–67table definition extensions, 148

transaction See transactions

consistency, 321consistent backups, 440–441consistent snapshot drivers, 461–462constant propagation, 603–605constants, MySQL Proxy, 766–771constraints

key See key constraints

MySQL deviations, 111–112security with stored routines, 256simulating check in views, 310–312

control flowfunctions, 791stored routine, 282–284conversion

datetime types, 188, 190–191functions, 810–812

CONVERTdata types for, 811defined, 102MySQL support, 107copying databases, 467corruption

hardware, 352table maintenance, 150–154count caching, 424–427CPU test mode, 554

crash recovery See recovery

CREATE, 63CREATE FUNCTION, 269CREATE PROCEDURE, 268CREATE TABLE

defined, 421RANGE partitioning, 497–502creating

basic stored functions, 268–269events, 291–292

extensions, 118–119Falcon tablespaces, tables and indexes, 409indexes, 223–225

key constraints, 231–237MERGE tables, 511–512stored routines, 256–257triggers, 243–244users, 478–479views, 302–303cryptographic functions, 788–789CSV (Comma Separated Value), 420–421Ctrl functions, 58

cursorsmysql commands, 58updatable, 109using, 287–289custom installation, 22custom queries, 551–552custom tables, 551–552

D

daemonsLinux-HA heartbeat, 742–744memcached, 434–438

MySQL Proxy See MySQL Proxy

Trang 13

Index D

running multiple on same server, 360security, 654–656

daily backups, 444data

access strategies, 596–606

backing up See backup

changes and foreign key constraints, 234

constraints See key constraints

converting character sets, 104drift, 540–543

exchange, 420insertion with phpMyAdmin, 70logs, 412–414

nodes, 744–746

querying See queries recovery See recovery

security, 656–665

synchronization See synchronization

table maintenance extensions, 150–156transfer, 354

Data Definition Language (DDL) statements, 322

Data Dictionary, MySQL See MySQL Data Dictionary Data Manipulation Language (DML) See DML (Data

Manipulation Language)Data Manipulation Statements (DMS), 575data types

binary large object string, 168–170Boolean, 180–183

character string, 160–166choosing SQL modes, 201–211conversions, 810–812date and time functions, 797–806datetime, 183–193

ENUM and SET, 195–200FULLTEXT index support, 238indexing, 226–227

interval, 193–194mathematical functions and numbers, 795–797MySQL deviations, 106

MySQL Proxy tokens, 773national character string, 166–168NULL values, 211–212

numeric, 170–180optimal for existing data, 212–216overview, 159

string functions on TEXT types, 806–810summary, 217

XML functions, 812Database Explorer, 72Database Usage screen, 33

databasesaccess, 654changing with use, 57client tool options, 52–53copying to backup, 467links, 416

management tools See GUI (Graphical User Interface)

tools

monitoring See monitoring systems partitioning See partitioning

privileges, 481–482setting characters sets and collation, 101SHOW CREATE commands, 137–139dates

DATE data types, 183–192SQL mode definitions, 204, 207–209datetime types

defined, 183–193functions, 797–806DAY_TIME data types, 193–194DDL (Data Definition Language) statements, 322deadlocks

Falcon parameters, 406InnoDB status, 389page-level and row-level, 341transaction, 336–343Debian

rotating logs, 524tuning, 353debuggingFalcon parameters, 403–404mysqladmin commands, 63with SHOW ENGINE InnoDB STATUS, 389–390stored routine conditions and handlers, 275–281with system command, 62

user account problems, 490–494DECIMAL, 172

Decision Support, 34DECLARE

stored routine conditions, 281using cursors, 287–288Dedicated MySQL server machine,

32default backup drivers, 461–462default behavior, 203

DEFAULT valuescharacter string type attributes, 165datetime type attributes, 191–192ENUM and SET attributes, 198numeric type attributes, 177defense in depth, 649

Trang 14

D Index

definerschanging trigger, 250–252specifying view, 306–307defining views

abstraction and simplification, 307–308changing definitions, 316–317definer specification, 306–307limitations and unexpected behavior, 304–305overview, 302–303

performance, 308–313security and privacy, 305–306updatable, 313–316

defragmentationInnoDB tablespace, 390partition table, 509query cache, 433–434table maintenance extensions, 154–155DELAY_KEY_WRITE, 148

delaying inserts, 121–122DELETE

batching, 628–629DML extensions, 120–121EXPLAIN on, 614foreign key constraints and, 234invoking triggers, 242–243mysql commands, 58rows from MEMORY tables, 395slave servers and recovery, 443updatable views, 313–316updating indexes, 223delimiters

mysql commands, 60stored procedure, 257trigger, 245

DES keys, 130DESC keyword, 226DESCRIBE, 109descriptor areas, 109design with MySQL Workbench, 80–83destination hosts, 467

Detailed Configuration, 31–32determinism

caching SELECT statements, 427–428stored routine options, 266–267Developer machine, 32

deviationscheck constraints, 111–112privileges and permissions, 110transaction management, 110–111understanding, 105–110upsert statements, 112–114

diagnostics management, 110diagrams, Workbench, 82–83

Dictionary, MySQL Data See MySQL Data Dictionary

directivesconfiguration file, 29

in server option file, 362directories

copying databases to backup, 467creating LVM, 458–459ibbackup, 464–465MySQL server archive package, 19partitioning, 354

SQL mode definitions, 206table definition extensions, 148trigger storage, 252–254dirty reads

defined, 326READ UNCOMMITTED, 329–330disabled event schedulers, 290disabled events, 294–295disaster planning, 471–472

disaster recovery See recovery

disk space, 155

displaying permissions See permissions display

DISTINCTROW, 128distributed caching, 434distributed replicated block devices (DRBDs), 738–739DML (Data Manipulation Language)

EXPLAIN on non-SELECT statements, 614extensions, 119–124

using to update views, 313–314DMS (Data Manipulation Statements), 575documentation

MySQL, 817–818

in MySQL community, 6domain support, 108dot notation, 95–97DOUBLE, 174–176double dash ( ), 88double quotation mark (”)naming limitations and, 93SQL mode definitions, 204double-buffering, 357downloading MySQL, 12DRAM-based drives, 351–352DRBDs (distributed replicated block devices),

738–739drivers, backup, 461–462DROP, 63

DROP TABLE, 422

Trang 15

Index E

droppingevents, 291–292extensions, 124–125indexes, 223–225key constraints, 231–237MERGE tables, 513partitions, 507–509stored routines, 261triggers, 244–245users, 478–479views, 303dual licensing model, 4dual-master replication, 735–736dumps

defined, 446–450maatkit parallel restore and, 450–451mysqldumpslow, 583–584

duplicate key errors, 117–118durability, 321–322

dynamic shared objects, 722–723dynamic variables

assigning values to, 134–135server tuning, 371–372slow query log management, 521

E

editing with Query Browser, 71ego command, 61

embedded declarations, 108–109enabled events, 294–295encryption

backup, 466–467connectivity, 659–664data flow security, 658functions, 788–789end of life versions, 569end times, 293–294endian formats, 379ENGINES, 697enginesSHOW commands, 139–140SQL mode definitions, 206

storage See storage engines

table definition extensions, 148Enterprise, MySQL, 5–6

Enterprise Monitoring, MySQL, 644–645Entity Relationship (ER) diagram, 82–83ENUM, 195–200

error logsdefined, 517–518

event, 297–298installation problems, 26troubleshooting MySQL servers, 47–48ERROR_FOR_DIVISION_BY_ZERO, 204–205errors

creating events, 292determinism and stored routines, 267foreign key constraint requirements, 235–237InnoDB status, 389

myisam_ftdump, 383MySQL deviations, 105partition table restrictions, 510SHOW commands, 137, 140source command, 55SQL modes, 201–203stored routine, 274–275stored routine conditions and handlers, 275–281stored routine warning, 257–259

escape characters, 91–93escape sequences, 91–93Essentials package, 21EVENTS, 691–693events

after last execution, 296–297backup and storage, 300caching with Event Scheduler, 424–426changing, 295–296

creating and dropping, 291–292Event Scheduler, 708

finding all, 295limitations, 299

logging, 297–298 See also logs

runtime behavior, 298–299SHOW commands, 140–141SHOW CREATE commands, 138start and end times for periodic, 293–294status, 294–295

stored routines, triggers and, 241–242turning on scheduler, 289–290exclamation point (!), 89execution

after event, 296–297MySQL deviations, 110plans, 595

SysBench, 552exiting mysql, 56expensive operation batching, 628–629expire_logs_days, 523

EXPLAINdata access strategy, 596–606EXTENDED, 612–613

Trang 16

E Index

EXPLAIN (continued)

extra, 608–611

on non-SELECT statements, 614overview, 590–595

plan indexes, 606–607rows, 607–608subqueries and, 611–612EXPLAIN PARTITIONS, 501–502exports

logical backups, 439–440with mysqldump, 449–450with SELECT INTO OUTFILE, 126–127ext2, 355–356

ext3, 355EXTENDED EXPLAIN, 612–613extended INSERT, 448extended status, 63eXtensible Markup Language (XML)functions, 812

LOAD XML INFILE, 123–124extensions

additional, 127–129aliases, 115ALTER TABLE, 115–118CREATE, 118–119DML, 119–124DROP, 124–125LIMIT, 125–126PLUGINS system view, 697–698SELECT, 126

SELECT INTO OUTFILE, 126–127server maintenance, 129–131

SET and user-defined variables, 131–135SHOW, 135–147

SHOW GLOBAL STATUS, 566–568summary, 158

table definition, 147–150table maintenance, 150–156transactional statement, 156–158using, 114–115

ExtraEXPLAIN, 608–611optimizing away Using temporary, 620–623Using filesort, 618–620

F

failoverdefined, 729master/master replication and, 736with MySQL Proxy, 740–741

Falconreplication support, 527storage engine options, 370–371understanding, 401–409FALSE, 94–95

FEDERATED storage engine, 415–417FETCH, 288–289

fieldsALTER TABLE extensions, 116ENUM and SET, 197

EXPLAIN See EXPLAIN INFORMATION_SCHEMA database system view See

MySQL Data Dictionarykey constraints, 220–221master-master replication and auto increment, 537optimal data type for existing data, 211–216redundant indexes, 230–231

setting characters sets and collation, 101–102SHOW SLAVE STATUS, 532–533

SQL mode definitions, 206triggers aliases, 244file systems

commercial backup options, 464–467LVM, 455–460

SAN and Microsoft VSS, 460setting characters sets and collation, 103snapshots, 451–452

testing with SysBench, 555–557ZFS, 453–454

filescomparing storage engines, 377–378configuration, 29–31

copying databases to backup, 467CSV, 420–421

ibdata, 390–392InnoDB status, 389limit of open, 357–358

option See option files

PBXT growth variables, 414shared tablespace, 392–393systems and partitions, 353–356tests, 556

trigger storage, 252–254finding

events, 295triggers, 252fixed-width stringsbinary data types, 171character string types, 160national character string types, 166

Trang 17

Index G

FLOATsizes and ranges, 174–176SQL mode definitions, 210floating point, 174

flow, data, 657–658flow controlfunctions, 791stored routine, 282–284FLUSH PRIVILEGES, 39FLUSH QUERY CACHE, 434FLUSH TABLES WITH READ LOCK, 452flushing

commands, 63defined, 129–131Falcon parameters, 406InnoDB storage engine options, 367–369logs, 522–523

FOR UPDATE, 127foreign key constraintscreating and dropping, 232–234defined, 219–231

InnoDB status, 389InnoDB support, 384KEY_COLUMN_USAGE, 682–684MySQL support, 107

partition table restrictions, 510REFERENTIAL_CONSTRAINTS, 684storage engine support, 377–378TABLE_CONSTRAINTS, 681–682formats

installation, 9–11interval types, 194row, 149forums, MySQL, 814–815fragmentation

in file system partitions, 354partition table, 509query cache, 433–434reducing with batching, 628–629table maintenance extensions, 154–155FreeBSD 7.0, 453–454

frequency, backup, 443–444full backup

defined, 440frequency, 443–444full index scans, 596–598full table scans

defined, 596optimization, 616–618

FULLTEXTALTER TABLE extensions, 116index types, 229–230, 237–239myisam_ftdump and, 382–383searching, 601

speeding lookups with, 222functional partitioning, 514functions

aggregation, 783–784ALTER TABLE, 115–118BENCHMARK, 546–547bitwise operators, 784–787compression and encryption, 788–789CREATE FUNCTION syntax,269

creating basic stored, 268–269data type conversions, 810–812date and time, 797–806datetime type, 188–190DML extensions, 119–124invoking stored functions, 269–270mathematical numbers and, 795–797MySQL deviations, 105–110

MySQL Proxy See MySQL Proxy

MySQL Proxy tokens, 774proxy tokenizer, 760–763server-level, 792–794SHOW commands, 141SHOW CREATE commands,138

SQL modes, 203–204

stored See stored routines

string on TEXT types, 806–810testing, logic and control flow, 789–792using index by eliminating, 623–626XML, 812

GLOBAL tables, 106GLOBAL_STATUS, 711GLOBAL_VARIABLES, 710GNU/Linux, 13–16

go command, 60–61gopher threads, 403grandfather-father-son backup rotation, 444

Trang 18

G Index

GRANTdefined, 110privileges and privilege levels, 651–653SHOW commands, 141

SQL mode definitions, 206user management, 481–487grant tables

defined, 474–475initializing, 36–37system tables, 476–478

Graphical User Interface (GUI) tools See GUI (Graphical

User Interface) toolsgraphing

with Cacti, 637–638Hyperic HQ, 638–640monitoring systems, 635with MONyog, 645–646with Munin, 642–643MySQL Enterprise Monitoring, 644–645OpenNMS, 640–641

GROUP BY, 620–621grouping

MySQL support, 108SQL mode definitions,209–210GUI (Graphical User Interface) toolsAdministrator, 74–80

phpMyAdmin, 69–71Query Browser, 71–74SQLyog, 66–69Workbench, 80–83

H

handlers, stored routine, 275–281hard drives

choosing, 349–352failure and backup, 441file system partitions, 353–356hardware, 349–352

Harrison, Guy, 282HASH partitioningdefined, 497working with, 503–504hashes

defined, 221–222index types, 228–229one-way, 656–657query cache, 428redundant indexes, 230

health monitoring See monitoring systems

helpcommand-line tools, 49resources, 813–820SysBench commands, 553high availability architecturesdefined, 442

DRBDs, 738–739Linux-HA heartbeat, 742–744MySQL Proxy, 739–742overview, 727–728with replication, 728–737SANs, 737–738

summary, 748HIGH_NOT_PRECEDENCE, 205hit ratio, 431

holes, 433horizontal partitioningdefined, 495–496programmatic, 514horizontal scaling, 727host strings

defined, 473–474wildcards in, 475–476, 650hosts

command-line tool options, 51flushing, 63

server maintenance extensions, 130hot backups

defined, 441file system snapshots, 451–452InnoDB, 464–466

location, 445online, 460–462tools, 446Hyperic HQ, 638–640

I

ibbackup, 464–466ibdata files, 390–392IDENTIFIED BY, 479identifiers

dot notation, 95–97naming limitations and quoting, 93–95

IF, 282

IF EXISTS, 124–125

IF NOT EXISTS, 118–119IGNORE

ALTER TABLE extensions, 117–118DML extensions, 119

IGNORE_SPACE, 206

Trang 19

Index I

implicit COMMIT, 322implicit transactions, 156inconsistent reads, 331incremental backupsdefined, 440frequency, 443–444what to back up, 445index types

creating and dropping key constraints, 231–237FULLTEXT, 237–239

keys and, 219–221MySQL deviations, 106speeding up lookups, 221–231summary, 239–240

index_merge, 599–600indexes

adding to queries, 616–620ALTER TABLE extensions, 116–117binary log files, 518

caching, 410–411CREATE extensions, 119creating Falcon, 409enumerations, 195–197EXPLAIN and, 606–607factors affecting key usage, 615Falcon parameters, 405, 406Lua, 758

MyISAM buffer, 366prefixes, 226relay log files, 520scans, 596–606SHOW commands, 141–142storage engine implementation, 377–378table definition extensions, 148table maintenance extensions, 150–156using by eliminating functions, 623–626view, 310

INFORMATION_SCHEMA database system views

See MySQL Data Dictionary

initial configurationMySQL, 29–31

of MySQL on Windows, 23–24injecting queries, 764–766injection, SQL, 657–658in-memory caches, 434InnoDB

backing up, 445copying databases to backup, 467hot backup program, 464–466storage engine options, 367–370

Tablespace screen, 34understanding, 384–394INOUT arguments, 261–262inputs

datetime types, 185–187stored routine options, 266–267INSERT

batching, 628–629DML extensions, 121–122EXPLAIN on, 614extended, 448foreign key constraints and, 234invoking triggers, 242–243keys and indexes, 220with phpMyAdmin, 70table definition extensions, 148–149updatable views, 313–316updating indexes, 223upsert statements, 112–114INSERT DELAYED, 704–705insert ratio, 432

installationLVM, 456MySQL Proxy, 750–751PBXT binary plug-in, 415plugin, 724–725semisynchronous replication plug-in, 525–526installation, MySQL server

before, 9–12Configuration Wizard on Windows, 31–36initial configuration, 29–31

from noinstall zip archive, 24–25overview, 12–13

post-install configuration on Unix, 36–39securing, 40–41

starting and stopping as Windows service, 26–29starting and stopping from Windows command line,25–26

summary, 48troubleshooting, 47–48

on Unix, 13–20upgrading mysqld, 45–47

on Windows, 20–24Windows PATH variable configuration, 42–44integer data types

attributes, 178–180sizes and ranges, 172–173interrupted transactions, 343–344interval types, 193–194INTERVAL units, 800–802INTO OUTFILE, 450

Trang 20

I Index

introducerscharacter sets and, 102language structure, 88–89invalid data, 201–203invalidation, query cachedefined, 428minimizing, 433–434invoking

changing event runtime behavior, 299changing trigger runtime behavior, 250–252stored functions, 269–270

stored routines, 259–260triggers, 242–243I/O schedulers, 358–359I/O test mode, 555–557I/O threads

defined, 525InnoDB status, 389semisynchronous replication, 527slave promotion and, 730–731IRC channels, 6

isolation levelsdefined, 321Falcon parameters, 406transaction, 325–335ITERATE, 284iterations, 552

J

Java Runtime Environment (JRE), 639JFS (Journaled File System), 355joins

nonunique index values, 601–602optimizing away Using temporary, 620–623unique index values and, 602

Journaled File System (JFS), 355

K

kernelparameters, 357tuning Linux, 357–359key cache, 131

key columns, 497key constraintscreating and dropping, 231–237

in EXPLAIN plan indexes, 606–607factors affecting usage, 615index types and, 219–221KEY_COLUMN_USAGE, 682–684MySQL support, 111–112

REFERENTIAL_CONSTRAINTS, 684TABLE_CONSTRAINTS, 681–682upsert statements, 112–114key files, 661–662

KEY_COLUMN_USAGE, 682–684keys, partition

defined, 497LIST, 503partition table restrictions, 510RANGE, 500–502

working with, 504keywords

character string types, 160–161datetime types, 183

locking, 792–794MySQL Proxy tokens, 774–782national character string types, 166numeric types, 170–171

KILLdefined, 63server maintenance extensions, 130Kneschke, Jan, 739

Kruckenberg, Mike, 744

L

language structurecase-sensitivity, 90–91character sets and collations, 98–105comments and portability, 88–90dot notation, 95–97

escape characters, 91–93naming limitations and quoting, 93–95stored routine flow control, 282–285stored routines, events and triggers, 242time zones, 97–98

trigger, 245–246languages

Lua, 741Lua basics, 757–763memcached programming API libraries, 436stored routine options, 266

Larsson, Allan, 4latin1 character set, 100LEAVE, 284

lengthbinary data types, 171binary large object string types, 169–170character string types, 162–164datetime type, 184

index, 226–228

Ngày đăng: 24/10/2013, 12:15

TỪ KHÓA LIÊN QUAN