COPYRIGHTED MATERIAL

mysqladmin,62–66 Symbols phpMyAdmin, 69–71 -- (double dash), 88 Query Browser, 71–74 # (pound), 89–90 SQLyog, 66–69 % (modulus operator), 503–504 summary, 83–84 || (string concatenation) Workbench, 80–83 MySQL support, 107 accounts, user SQL mode definitions, 210 debugging problems, 490–494 \ (backslash) managing, 478–487 escape characters, 91–93 ACID (atomicity, consistency, isolation and durability) naming limitations and quoting, 93–94 compliance .(dot),95–97 defined, 319–320 ” (double quotation mark) PBXT, 410 naming limitations and, 93 understanding, 320–322 SQL mode definitions, 204 ACLs (Access Control Lists) ! (exclamation point), 89 defined, 474–475 ? (question mark), 49 securing MySQL, 649–653 ; (semi-colons), 60 security with stored routines, 256 ’ (single quotation mark), 93 activity logging, 520–522 \. (source),54–55 administration 32-bit systems Administrator tool, 74–80 vs. 64-bit systems, 12 log. See logs choosing hardware, 349–350 measuring performance. See performance measurement \! command, 62 with mysqladmin,62–66 64-bit systems server tuning. See MySQL server tuning vs. 32-bit systems, 12 storage engine. See storage engines choosing hardware, 349–350 user management. See user management OS architecture, 352 agent-based systems, 635–636 agentless systems, 635–636 aggregate functions A NULL values and, 211 abstraction, view, 307–308 overview, 783–784 access. See also security alerts, monitoring. See monitoring systems data access strategy, 596–606 algorithms database, 654 MyISAM index buffer, 366 user account problems, 491 partitioning, 496–497 Access Control Lists (ACLs). See ACLs (Access Control view, 309–310 Lists) aliases accessing MySQL creating trigger, 244 Administrator, 74–80 extension, 115 command-line client tool, 52–62 table, 592–594 with command-line tools, 49–52 ALLOW_INVALID_DATES, 204

823 A Index

alpha releases, 11–12 atomicity, consistency, isolation and durability (ACID) ALTER EVENT, 295–296 compliance. See ACID (atomicity, consistency, ALTER ROUTINE, 270–271 isolation and durability) compliance ALTER TABLE attributes adding/dropping indexes, 223–225 binary data types, 171 adding/dropping partitions, 507–509 changing events, 296 creating/dropping key constraints, 231–237 character string type, 164–166 defined, 421 datetime type, 191–192 extensions, 115–118 ENUM and SET data types, 198–200 ALTER VIEW, 316–317 national character string types, 167 ANALYZE TABLE numeric type, 177–180, 181–182 defined, 156 auditing, trigger-based, 664–665 authentication query analysis, 615 data security, 656–665 analyzing queries. See query analysis lack of client support, 491–492 anonymous users managing user. See user management creating, 35–36 privileges. See privileges removing, 39 AUTO_INCREMENT ANSI, 204 master/master replication, 537, 735 ANSI QUOTES , 204 numeric type attributes, 177–178 Apache, 360 table definition extensions, 147 API (Application Programming Interface) autocommit mode, 157, 324–325 memcached programming libraries, 436 auto-completion security with stored routines, 256 commands, 58–59 Apple OS. See Mac OS SQLyog, 67 Application Programming Interface (API) auto-generated data, 551 memcached programming libraries, 436 automated failover security with stored routines, 256 defined, 729 application-level partitioning, 514 with -HA heartbeat, 742–744 architecture with MySQL Proxy, 740–741 , 402–403 automated monitoring. See monitoring systems high availability. See high availability architectures automated startup, 42 , 352–353 automatic updates, 187–188 PBXT, 410–411 Axmark,David,4 Archive backing up, 462–463 understanding, 417–419 B backends archive packages, 18–20 changing query, 763–764 arguments MySQL Proxy, 751–755 bitwise operators, 784–787 backslash (\) INOUT to stored procedure, 261–262 escape characters, 91–93 Lua basics, 758–759 naming limitations and quoting, 93–94 mysqladmin,62–66 backup stored routines, events and triggers, 242 commercial options, 464–467 arithmetic MySQL Proxy tokens, 773 comparing storage engines, 377–378 articles on MySQL, 818 copying databases, 467 assertions, 108 event, 300 asynchronous replication file system snapshot, 451–452 defined, 524–525 frequency, 443–444 multi-master, 538–539 LVM, 455–460 atomicity, 321 maatkit parallel dump/restore, 450–451

824 Index C

methods, 445–446 bitwise operators, 784–787 MySQL, 439–441 black box queries, 255–256 mysqldump, 446–450 Blackhole mysqlhotcopy, 462–463 complex replication, 536 online, 460–462 replication support, 527 phpMyAdmin, 70 understanding, 419–420 SAN and Microsoft VSS, 460 blank values, 650 security, 656 BLOB SELECT INTO OUTFILE, 450 data types, 168–170 simple replication, 530–531 indexing, 226–227 SQL Administrator, 79 block devices, 738–739 stored routine, 286–287 blogging, 6 summary, 472 bogging down, 585 trigger, 252–254 Boolean types, 180–183 uses for, 441–443 Bouman, Roland, 716, 744 what to and where to, 445 BTREE indexes ZFS, 453–454 defined, 221–222 bad passwords, 490–491 order, 225–226 batching redundant, 231 executing non-interactively, 54–55 types, 228–229 expensive operations, 628–629 buffer pools, 579 frequent operations, 629–631 buffers battery-backed write cache, 351 defined, 356–357 BEGIN, 322 InnoDB configuration, 385 BEGIN WORK, 322 InnoDB status, 389 benchmarking InnoDB storage engine options, 367–369 defined, 545–546 MyISAM, 365–366 with mysqlslap, 547–552 profiling, 574 overview, 546–547 storage engine support, 377–378 recommendations, 565–566 bugs. See also debugging with SysBench. See SysBench BIT_AND NULL, 784 Best Support For Multilingualism, 35 reports, 816 beta releases, 11–12 building queries, 67–69 binary collations character string type attributes and, 165 defined, 98 C binary file vs. source code, 10 CA (Certificate Authority) binary large object string types, 168–170 command-line tool options, 53 binary logs encrypted connectivity, 662 backing up, 445 cache hit ratio, 365–366 crash recovery, 468–471 caching defined, 518–519 implementing tables, 424–427 master/master replication and, 736 memcached, 434–438 rotating, 522–524 overview, 423–424 binary MySQL Proxy distributions, 750–751 PBXT configuration, 412 binary packages, 20–24 profiling, 576–577 binary plug-ins, 415 query cache, 427–434 bin-log, 732 scaling with memcached, 747 BIT summary, 438 NULL and, 784 Cacti, 637–638 sizes and ranges, 173–174 CALL, 259–260

825 C Index

Callaghan, Mark, 525 SHOW commands, 136–137 canceling queries, 59–60 table definition extensions, 147 capacity planning, 585 CHARACTER_SETS, 695–696 cardinality, index, 615 characters CASCADE, 234 bit functions, 786 cascading replication, 535–536 case-sensitivity, 90–91 CASE, 282–283 escape, 91–93 case-sensitivity index length, 226–228 binary collations, 98 Lua basics, 757 escape characters, 92 national string types, 166–168 Falcon tablespace, 409 sets and collations, 98–105 language structure, 90–91 string types, 160–166 query cache, 428 wildcards, 475–476 CAST cheat sheets, 817–818 data types for, 811 check constraints defined, 102–105 MySQL deviations, 111–112 MySQL support, 107 simulating in views, 310–312 catalogs CHECK TABLE, 150–153 managing with Administrator, checksums 80 correcting data drift, 540–542 MySQL support, 107 table definition extensions, 147–148 object. See object catalog table maintenance extensions, 156 catch-all partitions, 499 child tables, 234 Certificate Authority (CA) chilling, 406 command-line tool options, 53 ciphers, 53 encrypted connectivity, 662 circular replication certificate files, 661–662 defined, 537–539 certification, MySQL, 820 scaling with, 736–737 CHANGE MASTER, 534 cleanup changelogs, 45–46 I/O test mode, 556–557 changing OLTP test mode, 563–565 events, 295–296 SysBench commands, 553 injecting queries and, 764–766 clear command MERGE tables, 512–513 defined, 59 query backend, 763–764 mysqladmin,63 stored routines, 270–271 client tool triggers, 246–247 MySQL access, 52–62 views, 316–317 setting characters sets and collation, 103 CHAR, 160–162 closing cursors, 287 character objects Cluster, MySQL. See MySQL Cluster character string types, 160 COALESCE PARTITION, 508–509 national character string types, 166 code Character Set screen, 35 language structure. See language structure character sets in MySQL community, 7 ALTER TABLE extensions, 116 source, 4 changing event, 299 source vs. binary file, 10 changing stored routine, 264 coercibility, 810–811 changing trigger, 249–250 cold backups character string type attributes and, 165–166 defined, 441 defined, 98–105 location, 445 MySQL support, 108 tools, 446

826 Index C

COLLATION_CHARACTER_ transactional statement extensions, 156–158 SET_APPLICABILITY, 696–697 triggers. See triggers COLLATIONS, 696 user management, 478–487 collations comments changing event, 299 applying to events, 295 changing stored routine, 264 language structure, 88–90 changing trigger, 249–250 Lua, 757 character string type attributes and, 165–166 stored routine options, 266 language structure, 98–105 table definition extensions, 148 MySQL support, 108 commercial backup options, 464–467 SHOW commands, 137 commercial monitoring systems, 644–646 table definition extensions, 148 COMMIT COLUMN_PRIVILEGES, 712–713 defined, 322 COLUMNS, 676–679 extensions, 156–158 columns community, 6–7 ALTER TABLE extensions, 118 compactor threads, 411 privileges, 482 company background, 4–5 SHOW commands, 137 comparison operators stored routine warning, 257–259 defined, 789–791 Comma Separated Value (CSV), 420–421 MySQL support, 106–107 COMMAND in PROCESSLIST, 699–700 compilation command-line tools plugin, 722–723 accessing MySQL with, 49–52 SysBench, 565 binary log, 519 Complete installation, 21–22 client tool, 52–62 Complete package, 21 Maria, 401 complex replication, 534–539 memcached, 435 composite INTERVAL units, 801–802 mysqladmin,62–66 composite keys, 220 proxy script behavior, 759 composite partitioning starting and stopping MySQL as service, 27 defined, 497 starting and stopping MySQL from Windows, 25–26 working with, 504–507 table maintenance, 154 compound foreign key constraints, 232 using with Query Browser, 73 compression commands Archive, 417–418 events. See events command-line tool options, 53 FLUSH TABLES WITH READ LOCK, 452 commercial backup options, 466–467 INFORMATION_SCHEMA database system view. See functions, 788–789 MySQL Data Dictionary ibbackup, 464 LVM, 455–460 with myisampack, 381–382 MySQL deviations. See deviations concatenation, 107 mysqlhotcopy, 462–463 concurrency vs. options, 56 Concurrent Connections screen, 34 partitioning, 507–510 multi-version control, 335 replication. See replication MyISAM, 378–379 rotating logs, 522–523 MyISAM inserts, 379–380 SHOW, 136–147 conditions, stored routine, 275–281 SHOW ENGINE InnoDB STATUS, 385–390 conferences, 819–820 SHOW ENGINE PBXT STATUS, 414–415 configuration storage engine, 421–422 Archive, 417–419 SysBench, 553 Configuration Wizard on Windows, 31–36 table maintenance extensions, 150–156 CSV, 420–421

827 C Index

configuration (continued) control flow encrypted connectivity, 663 functions, 791 Falcon, 403–409 stored routine, 282–284 FEDERATED storage engine, 415–417 conversion initial MySQL, 29–31 datetime types, 188, 190–191 InnoDB variables, 384–386 functions, 810–812 Maria, 396–401 CONVERT memcached, 435 data types for, 811 MEMORY, 395–396 defined, 102 MyISAM, 380 MySQL support, 107 MySQL Proxy backends, 751–755 copying databases, 467 PBXT, 411–414 corruption post-install on Unix, 36–39 hardware, 352 query cache, 429–433 table maintenance, 150–154 replication, 529–539 count caching, 424–427 securing, 40–41 CPU test mode, 554 slave promotion, 732 crash recovery. See recovery Windows PATH variable, 42–44 CREATE,63 configuration files. See option files CREATE FUNCTION, 269 Confirmation screen CREATE PROCEDURE, 268 configuration options, 36 CREATE TABLE defined, 24 defined, 421 RANGE connection pooling, 746–747 partitioning, 497–502 connections creating changing query backend, 763–764 basic stored functions, 268–269 command-line tool options, 51–52 events, 291–292 debugging account problems, 492 extensions, 118–119 encrypted, 659–664 Falcon tablespaces, tables and indexes, 409 indexes, 223–225 health monitoring, 78 key constraints, 231–237 memcached, 437 MERGE tables, 511–512 MySQL deviations, 109 stored routines, 256–257 MySQL Proxy backends, 751–755 triggers, 243–244 mysqladmin commands, 63–64 users, 478–479 profiling, 577–578 views, 302–303 Query Browser, 72–73 cryptographic functions, 788–789 securing operating systems, 654–655 CSV (Comma Separated Value), 420–421 server maintenance extensions, 130 Ctrl functions, 58 SQL Administrator, 76 cursors SQLyog, 66–67 mysql commands, 58 table definition extensions, 148 updatable, 109 transaction. See transactions using, 287–289 consistency, 321 custom installation, 22 consistent backups, 440–441 custom queries, 551–552 consistent snapshot drivers, 461–462 custom tables, 551–552 constant propagation, 603–605 constants, MySQL Proxy, 766–771 constraints D key. See key constraints daemons MySQL deviations, 111–112 Linux-HA heartbeat, 742–744 security with stored routines, 256 memcached, 434–438 simulating check in views, 310–312 MySQL Proxy. See MySQL Proxy

828 Index D

running multiple on same server, 360 databases security, 654–656 access, 654 daily backups, 444 changing with use,57 data client tool options, 52–53 access strategies, 596–606 copying to backup, 467 backing up. See backup links, 416 changes and foreign key constraints, 234 management tools. See GUI (Graphical User Interface) constraints. See key constraints tools converting character sets, 104 monitoring. See monitoring systems drift, 540–543 partitioning. See partitioning exchange, 420 privileges, 481–482 insertion with phpMyAdmin, 70 setting characters sets and collation, 101 logs, 412–414 SHOW CREATE commands, 137–139 nodes, 744–746 dates querying. See queries DATE data types, 183–192 recovery. See recovery SQL mode definitions, 204, 207–209 security, 656–665 datetime types synchronization. See synchronization defined, 183–193 table maintenance extensions, 150–156 functions, 797–806 DAY_TIME transfer, 354 data types, 193–194 DDL (Data Definition Language) statements, 322 Data Definition Language (DDL) statements, 322 deadlocks Data Dictionary, MySQL. See MySQL Data Dictionary Falcon parameters, 406 Data Manipulation Language (DML). See DML (Data InnoDB status, 389 Manipulation Language) page-level and row-level, 341 Data Manipulation Statements (DMS), 575 transaction, 336–343 data types Debian binary large object string, 168–170 rotating logs, 524 Boolean, 180–183 tuning, 353 character string, 160–166 debugging choosing SQL modes, 201–211 Falcon parameters, 403–404 conversions, 810–812 mysqladmin commands, 63 date and time functions, 797–806 with SHOW ENGINE InnoDB STATUS, 389–390 datetime, 183–193 stored routine conditions and handlers, 275–281 ENUM SET and , 195–200 with system command, 62 FULLTEXT index support, 238 user account problems, 490–494 indexing, 226–227 DECIMAL, 172 interval, 193–194 Decision Support, 34 mathematical functions and numbers, 795–797 DECLARE MySQL deviations, 106 stored routine conditions, 281 MySQL Proxy tokens, 773 using cursors, 287–288 national character string, 166–168 Dedicated MySQL server machine, NULL values, 211–212 32 numeric, 170–180 default backup drivers, 461–462 optimal for existing data, 212–216 default behavior, 203 overview, 159 DEFAULT values string functions on TEXT types, 806–810 character string type attributes, 165 summary, 217 datetime type attributes, 191–192 XML functions, 812 ENUM and SET attributes, 198 Database Explorer, 72 numeric type attributes, 177 Database Usage screen, 33 defense in depth, 649

829 D Index

definers diagnostics management, 110 changing trigger, 250–252 diagrams, Workbench, 82–83 specifying view, 306–307 Dictionary, MySQL Data. See MySQL Data Dictionary defining views directives abstraction and simplification, 307–308 configuration file, 29 changing definitions, 316–317 in server option file, 362 definer specification, 306–307 directories limitations and unexpected behavior, 304–305 copying databases to backup, 467 overview, 302–303 creating LVM, 458–459 performance, 308–313 ibbackup, 464–465 security and privacy, 305–306 MySQL server archive package, 19 updatable, 313–316 partitioning, 354 defragmentation SQL mode definitions, 206 InnoDB tablespace, 390 table definition extensions, 148 partition table, 509 trigger storage, 252–254 query cache, 433–434 dirty reads table maintenance extensions, 154–155 defined, 326 DELAY_KEY_WRITE , 148 READ UNCOMMITTED, 329–330 delaying inserts, 121–122 disabled event schedulers, 290 DELETE disabled events, 294–295 batching, 628–629 disaster planning, 471–472 DML extensions, 120–121 disaster recovery. See recovery EXPLAIN on, 614 disk space, 155 foreign key constraints and, 234 displaying permissions. See permissions display invoking triggers, 242–243 DISTINCTROW, 128 mysql commands, 58 distributed caching, 434 rows from MEMORY tables, 395 distributed replicated block devices (DRBDs), 738–739 slave servers and recovery, 443 DML (Data Manipulation Language) updatable views, 313–316 EXPLAIN on non-SELECT statements, 614 updating indexes, 223 extensions, 119–124 delimiters mysql commands, 60 using to update views, 313–314 stored procedure, 257 DMS (Data Manipulation Statements), 575 trigger, 245 documentation DES keys, 130 MySQL, 817–818 DESC keyword, 226 in MySQL community, 6 DESCRIBE, 109 domain support, 108 descriptor areas, 109 dot notation, 95–97 design with MySQL Workbench, 80–83 DOUBLE, 174–176 destination hosts, 467 double dash (--), 88 Detailed Configuration, 31–32 double quotation mark (”) determinism naming limitations and, 93 caching SELECT statements, 427–428 SQL mode definitions, 204 stored routine options, 266–267 double-buffering, 357 Developer machine, 32 downloading MySQL, 12 deviations DRAM-based drives, 351–352 check constraints, 111–112 DRBDs (distributed replicated block devices), privileges and permissions, 110 738–739 transaction management, 110–111 drivers, backup, 461–462 understanding, 105–110 DROP,63 upsert statements, 112–114 DROP TABLE, 422

830 Index E

dropping event, 297–298 events, 291–292 installation problems, 26 extensions, 124–125 troubleshooting MySQL servers, 47–48 indexes, 223–225 ERROR_FOR_DIVISION_BY_ZERO, 204–205 key constraints, 231–237 errors MERGE tables, 513 creating events, 292 partitions, 507–509 determinism and stored routines, 267 stored routines, 261 foreign key constraint requirements, 235–237 triggers, 244–245 InnoDB status, 389 users, 478–479 myisam_ftdump, 383 views, 303 MySQL deviations, 105 dual licensing model, 4 partition table restrictions, 510 dual-master replication, 735–736 SHOW commands, 137, 140 dumps source command, 55 defined, 446–450 SQL modes, 201–203 maatkit parallel restore and, 450–451 stored routine, 274–275 mysqldumpslow, 583–584 stored routine conditions and handlers, 275–281 duplicate key errors, 117–118 stored routine warning, 257–259 durability, 321–322 escape characters, 91–93 dynamic shared objects, 722–723 escape sequences, 91–93 dynamic variables Essentials package, 21 assigning values to, 134–135 EVENTS, 691–693 server tuning, 371–372 events slow query log management, 521 after last execution, 296–297 backup and storage, 300 caching with Event Scheduler, 424–426 E changing, 295–296 editing with Query Browser, 71 creating and dropping, 291–292 ego command, 61 Event Scheduler, 708 embedded declarations, 108–109 finding all, 295 enabled events, 294–295 limitations, 299 encryption logging, 297–298. See also logs backup, 466–467 runtime behavior, 298–299 connectivity, 659–664 SHOW commands, 140–141 data flow security, 658 SHOW CREATE commands, 138 functions, 788–789 start and end times for periodic, 293–294 end of life versions, 569 status, 294–295 end times, 293–294 stored routines, triggers and, 241–242 endian formats, 379 turning on scheduler, 289–290 ENGINES, 697 exclamation point (!), 89 engines execution SHOW commands, 139–140 after event, 296–297 SQL mode definitions, 206 MySQL deviations, 110 storage. See storage engines plans, 595 table definition extensions, 148 SysBench, 552 Enterprise, MySQL, 5–6 exiting mysql,56 Enterprise Monitoring, MySQL, 644–645 expensive operation batching, 628–629 Entity Relationship (ER) diagram, 82–83 expire_logs_days, 523 ENUM, 195–200 EXPLAIN error logs data access strategy, 596–606 defined, 517–518 EXTENDED, 612–613

831 E Index

EXPLAIN (continued) Falcon extra, 608–611 replication support, 527 on non-SELECT statements, 614 storage engine options, 370–371 overview, 590–595 understanding, 401–409 plan indexes, 606–607 FALSE,94–95 rows, 607–608 FEDERATED storage engine, 415–417 subqueries and, 611–612 FETCH, 288–289 EXPLAIN PARTITIONS, 501–502 fields exports ALTER TABLE extensions, 116 logical backups, 439–440 ENUM and SET, 197 with mysqldump, 449–450 EXPLAIN. See EXPLAIN with SELECT... INTO OUTFILE, 126–127 INFORMATION_SCHEMA database system view. See ext2, 355–356 MySQL Data Dictionary ext3, 355 key constraints, 220–221 EXTENDED EXPLAIN , 612–613 master-master replication and auto increment, 537 INSERT extended , 448 optimal data type for existing data, 211–216 extended status ,63 redundant indexes, 230–231 eXtensible Markup Language (XML) setting characters sets and collation, 101–102 functions, 812 SHOW SLAVE STATUS, 532–533 LOAD XML INFILE, 123–124 SQL mode definitions, 206 extensions triggers aliases, 244 additional, 127–129 file systems aliases, 115 commercial backup options, 464–467 ALTER TABLE, 115–118 LVM, 455–460 CREATE, 118–119 SAN and Microsoft VSS, 460 DML, 119–124 DROP, 124–125 setting characters sets and collation, 103 LIMIT, 125–126 snapshots, 451–452 PLUGINS system view, 697–698 testing with SysBench, 555–557 SELECT, 126 ZFS, 453–454 SELECT...INTO OUTFILE, 126–127 files server maintenance, 129–131 comparing storage engines, 377–378 SET and user-defined variables, 131–135 configuration, 29–31 SHOW, 135–147 copying databases to backup, 467 SHOW GLOBAL STATUS, 566–568 CSV, 420–421 summary, 158 ibdata, 390–392 table definition, 147–150 InnoDB status, 389 table maintenance, 150–156 limit of open, 357–358 transactional statement, 156–158 option. See option files using, 114–115 PBXT growth variables, 414 Extra shared tablespace, 392–393 EXPLAIN, 608–611 systems and partitions, 353–356 optimizing away Using temporary, 620–623 tests, 556 Using filesort, 618–620 trigger storage, 252–254 finding events, 295 F triggers, 252 failover fixed-width strings defined, 729 binary data types, 171 master/master replication and, 736 character string types, 160 with MySQL Proxy, 740–741 national character string types, 166

832 Index G

FLOAT FULLTEXT sizes and ranges, 174–176 ALTER TABLE extensions, 116 SQL mode definitions, 210 index types, 229–230, 237–239 floating point, 174 myisam_ftdump and, 382–383 flow, data, 657–658 searching, 601 flow control speeding lookups with, 222 functions, 791 functional partitioning, 514 stored routine, 282–284 functions aggregation, 783–784 FLUSH PRIVILEGES,39 ALTER TABLE, 115–118 FLUSH QUERY CACHE, 434 BENCHMARK, 546–547 FLUSH TABLES WITH READ LOCK, 452 bitwise operators, 784–787 flushing compression and encryption, 788–789 commands, 63 CREATE FUNCTION syntax, defined, 129–131 269 Falcon parameters, 406 creating basic stored, 268–269 InnoDB storage engine options, 367–369 data type conversions, 810–812 logs, 522–523 date and time, 797–806 FOR UPDATE, 127 datetime type, 188–190 foreign key constraints DML extensions, 119–124 creating and dropping, 232–234 invoking stored functions, 269–270 defined, 219–231 mathematical numbers and, 795–797 InnoDB status, 389 MySQL deviations, 105–110 InnoDB support, 384 MySQL Proxy. See MySQL Proxy KEY_COLUMN_USAGE, 682–684 MySQL Proxy tokens, 774 MySQL support, 107 proxy tokenizer, 760–763 partition table restrictions, 510 server-level, 792–794 SHOW commands, 141 REFERENTIAL_CONSTRAINTS, 684 SHOW CREATE commands, storage engine support, 377–378 138 TABLE_CONSTRAINTS, 681–682 SQL modes, 203–204 formats stored. See stored routines installation, 9–11 string on TEXT types, 806–810 interval types, 194 testing, logic and control flow, 789–792 row, 149 using index by eliminating, 623–626 forums, MySQL, 814–815 XML, 812 fragmentation in file system partitions, 354 partition table, 509 G ++ query cache, 433–434 g plugin compilation, 723 GA (generally available) releases, 5, 11–12 reducing with batching, 628–629 general query logs, 520–522 table maintenance extensions, 154–155 General Statistics, 569 FreeBSD 7.0, 453–454 generally available (GA) releases, 5, 11–12 frequency, backup, 443–444 global privileges, 481 full backup GLOBAL tables, 106 defined, 440 GLOBAL_STATUS, 711 frequency, 443–444 GLOBAL_VARIABLES, 710 full index scans, 596–598 GNU/Linux, 13–16 full table scans go command, 60–61 defined, 596 gopher threads, 403 optimization, 616–618 grandfather-father-son backup rotation, 444

833 G Index

GRANT help defined, 110 command-line tools, 49 privileges and privilege levels, 651–653 resources, 813–820 SHOW commands, 141 SysBench commands, 553 SQL mode definitions, 206 high availability architectures user management, 481–487 defined, 442 grant tables DRBDs, 738–739 defined, 474–475 Linux-HA heartbeat, 742–744 initializing, 36–37 MySQL Proxy, 739–742 system tables, 476–478 overview, 727–728 Graphical User Interface (GUI) tools. See GUI (Graphical with replication, 728–737 User Interface) tools SANs, 737–738 graphing summary, 748 with Cacti, 637–638 HIGH_NOT_PRECEDENCE, 205 Hyperic HQ, 638–640 hit ratio, 431 monitoring systems, 635 holes, 433 with MONyog, 645–646 horizontal partitioning with Munin, 642–643 defined, 495–496 MySQL Enterprise Monitoring, 644–645 programmatic, 514 OpenNMS, 640–641 horizontal scaling, 727 GROUP BY, 620–621 host strings grouping defined, 473–474 MySQL support, 108 wildcards in, 475–476, 650 SQL mode definitions, hosts 209–210 command-line tool options, 51 GUI (Graphical User Interface) tools flushing, 63 Administrator, 74–80 server maintenance extensions, 130 phpMyAdmin, 69–71 hot backups Query Browser, 71–74 defined, 441 SQLyog, 66–69 file system snapshots, 451–452 Workbench, 80–83 InnoDB, 464–466 location, 445 online, 460–462 H tools, 446 handlers, stored routine, 275–281 Hyperic HQ, 638–640 hard drives choosing, 349–352 failure and backup, 441 I file system partitions, 353–356 ibbackup, 464–466 hardware, 349–352 ibdata files, 390–392 Harrison, Guy, 282 IDENTIFIED BY, 479 HASH partitioning identifiers defined, 497 dot notation, 95–97 working with, 503–504 naming limitations and quoting, 93–95 hashes IF, 282 defined, 221–222 IF EXISTS, 124–125 index types, 228–229 IF NOT EXISTS, 118–119 one-way, 656–657 IGNORE query cache, 428 ALTER TABLE extensions, 117–118 redundant indexes, 230 DML extensions, 119 health monitoring. See monitoring systems IGNORE_SPACE, 206

834 Index I

implicit COMMIT, 322 Tablespace screen, 34 implicit transactions, 156 understanding, 384–394 inconsistent reads, 331 INOUT arguments, 261–262 incremental backups inputs defined, 440 datetime types, 185–187 frequency, 443–444 stored routine options, 266–267 what to back up, 445 INSERT index types batching, 628–629 creating and dropping key constraints, 231–237 DML extensions, 121–122 FULLTEXT, 237–239 EXPLAIN on, 614 keys and, 219–221 extended, 448 MySQL deviations, 106 foreign key constraints and, 234 speeding up lookups, 221–231 invoking triggers, 242–243 summary, 239–240 keys and indexes, 220 index_merge, 599–600 with phpMyAdmin, 70 indexes table definition extensions, 148–149 adding to queries, 616–620 updatable views, 313–316 ALTER TABLE extensions, 116–117 updating indexes, 223 binary log files, 518 upsert statements, 112–114 INSERT DELAYED, 704–705 caching, 410–411 insert ratio, 432 CREATE extensions, 119 installation creating Falcon, 409 LVM, 456 enumerations, 195–197 MySQL Proxy, 750–751 EXPLAIN and, 606–607 PBXT binary plug-in, 415 factors affecting key usage, 615 plugin, 724–725 Falcon parameters, 405, 406 semisynchronous replication plug-in, 525–526 Lua, 758 installation, MySQL server MyISAM buffer, 366 before, 9–12 prefixes, 226 Configuration Wizard on Windows, 31–36 relay log files, 520 initial configuration, 29–31 scans, 596–606 from noinstall zip archive, 24–25 SHOW commands, 141–142 overview, 12–13 storage engine implementation, 377–378 post-install configuration on Unix, 36–39 table definition extensions, 148 securing, 40–41 table maintenance extensions, 150–156 starting and stopping as Windows service, 26–29 using by eliminating functions, 623–626 starting and stopping from Windows command line, view, 310 25–26 INFORMATION_SCHEMA database system views. summary, 48 See MySQL Data Dictionary troubleshooting, 47–48 initial configuration on Unix, 13–20 MySQL, 29–31 upgrading mysqld,45–47 of MySQL on Windows, 23–24 on Windows, 20–24 injecting queries, 764–766 Windows PATH variable configuration, 42–44 injection, SQL, 657–658 integer data types in-memory caches, 434 attributes, 178–180 InnoDB sizes and ranges, 172–173 backing up, 445 interrupted transactions, 343–344 copying databases to backup, 467 interval types, 193–194 hot backup program, 464–466 INTERVAL units, 800–802 storage engine options, 367–370 INTO OUTFILE, 450

835 I Index

introducers REFERENTIAL_CONSTRAINTS, 684 character sets and, 102 TABLE_CONSTRAINTS, 681–682 language structure, 88–89 upsert statements, 112–114 invalid data, 201–203 key files, 661–662 invalidation, query cache KEY_COLUMN_USAGE, 682–684 defined, 428 keys, partition minimizing, 433–434 defined, 497 invoking LIST, 503 changing event runtime behavior, 299 partition table restrictions, 510 changing trigger runtime behavior, 250–252 RANGE, 500–502 stored functions, 269–270 working with, 504 stored routines, 259–260 keywords triggers, 242–243 character string types, 160–161 I/O schedulers, 358–359 datetime types, 183 I/O test mode, 555–557 locking, 792–794 I/O threads MySQL Proxy tokens, 774–782 defined, 525 national character string types, 166 InnoDB status, 389 numeric types, 170–171 semisynchronous replication, 527 KILL slave promotion and, 730–731 defined, 63 IRC channels, 6 server maintenance extensions, 130 isolation levels Kneschke, Jan, 739 defined, 321 Kruckenberg, Mike, 744 Falcon parameters, 406 transaction, 325–335 ITERATE, 284 iterations, 552 L language structure case-sensitivity, 90–91 J character sets and collations, 98–105 Java Runtime Environment (JRE), 639 comments and portability, 88–90 JFS (Journaled File System), 355 dot notation, 95–97 joins escape characters, 91–93 nonunique index values, 601–602 naming limitations and quoting, 93–95 optimizing away Using temporary, 620–623 stored routine flow control, 282–285 unique index values and, 602 stored routines, events and triggers, 242 Journaled File System (JFS), 355 time zones, 97–98 trigger, 245–246 languages K Lua, 741 kernel Lua basics, 757–763 parameters, 357 memcached programming API libraries, 436 tuning Linux, 357–359 stored routine options, 266 key cache, 131 Larsson, Allan, 4 key columns, 497 latin1 character set, 100 key constraints LEAVE, 284 creating and dropping, 231–237 length in EXPLAIN plan indexes, 606–607 binary data types, 171 factors affecting usage, 615 binary large object string types, 169–170 index types and, 219–221 character string types, 162–164 KEY_COLUMN_USAGE, 682–684 datetime type, 184 MySQL support, 111–112 index, 226–228

836 Index L

national character string types, 167 log files numeric data, 172–176 InnoDB, 393–394 optimal data type for existing data, 211–216 Maria configuration, 397 levels logical backups charset and collation, 101–104 crash recovery, 468 isolation. See isolation levels defined, 439–440 locking, 336–343 with maatkit, 450–451 privilege, 481–485, 651–653 with mysqldump, 446–450 RAID, 350–351 online, 460–462 Li, Wei, 525 vs. physical backups, 442 LIKE, 136 logical functions, 792 LIMIT, 120, 125–126 Logical Volume Manager (LVM) limitations defined, 455–460 event, 299 file system partitions and, 355 of FEDERATED tables, 417 logical volumes, 455–460 MySQL Backup, 462 logs stored routine, 285–286 backing up, 445 trigger, 254–255 crash recovery, 468–471 updatable view, 314–315 event, 297–298 view definition, 304–305 Falcon parameters, 403–404 LINEAR HASH partitioning, 504 flushing, 63 LINEAR KEY partitioning, 504 InnoDB status, 389 linked servers, 416 InnoDB storage engine options, Linux 369–370 copying databases to backup, 467 managing with Administrator, 80 LVM backup, 455–460 operating system security, 654–656 monitoring. See monitoring systems overview, 517–524 semisynchronous replication, PBXT architecture, 411 525 PBXT configuration, 412–414 tuning, 352–360 recovering transactions, 343–344 Linux-HA heartbeat, 742–744 redo, 322 LIST partitioning defined, 496–497 replication data, 527–529. See also replication working with, 502–503 security, 656 load balancing, 740, 755–756 serial, 403 LOAD DATA INFILE, 122–123 serial configuration, 407–408 LOAD XML INFILE, 123–124 server maintenance extensions, 130 local hosts, 51–52 summary, 543 LOCAL tables, 106 LONGTEXT, 164 local variables lookups SET extension and, 134 nonunique, nullable index values, 600 stored routines, 262–264 nonunique index values, 601–602 location, backup, 445 speeding up with indexes, 221–231 LOCK IN SHARE MODE, 128 unique index values, 603 locking LOOP, 284 Falcon parameters, 406 Lua file system snapshots, 452 basics, 757–763 keyword, 792–794 defined, 741 profiling, 577, 579–580 scripting MySQL Proxy, 755–756 storage engine support, 377–378 LVM (Logical Volume Manager) tables, 131 defined, 455–460 transaction, 336–343 file system partitions and, 355

837 M Index

health monitoring, 78 M index types and, 228–229 maatkit InnoDB status, 389 correcting data drift, 540–543 optimal data type for existing data, 211–216 mk-query-profiler, 581–582 page-level locks, 341 parallel dump/restore, 450–451 protocols, 51 Mac OS query cache usage, 429–432 backup with ZFS, 453–454 setting InnoDB buffer pool, 367–369 case-sensitivity, 91 swap, 359 monitoring. See monitoring systems test mode, 559–561 magazines, 7 MEMORY storage engine, 394–396 mailing lists, 6, 815–816 MERGE maintenance partitioning tables, 510–513 partition table, 509–510 upsert and, 112 server, 129–131 table extensions, 150–156 view algorithm, 309–310 management, user. See user management Merge storage engine, 383–384 man-in-the-middle attacks, 53 metadata Manual Selected Default Character Set/Collation, 35 defining plugins, 716–722 EXPLAIN Manual Setting, 34 , 595 INFORMATION_SCHEMA many read slaves, 734–735 database system. See Maria MySQL Data Dictionary storage engine options, 371 maintaining table statistics, 155–156 understanding, 396–401 MySQL deviations, 106 master servers plugin compilation, 722–723 backing up with mysqldump, 450 plugin installation, 724–725 Blackhole storage engine uses, 419–420 retrieval using SHOW, 135–147 configuration, 529–539 storage engines, 716 correcting data drift, 540–543 metrics, mysqltuner, 570–572 high availability and scaling with replication, 728–737 microseconds Linux-HA heartbeat architecture, 743 datetime types, 186–187 replication, 524–529 INTERVAL units, 800–802 summary, 543 Microsoft VSS (Volume Shadow Copy Service), 460 master-master replication, 536–537, 735–736 MIN_ROWS, 149 materialized views, 310 mirrored pools, 453–454 mathematical numbers, 795–797 mission, 3–6 max_binlog_size, 523 mixed-base replication (MBR), 527–529 MAX_ROWS, 149 mk-query-profiler, 580–583 MAXDB, 206 mk-show-grants, 485–487 MAXVALUE, 499 mk-table-checksum, 540–542 MBR (mixed-base replication), 527–529 mk-table-sync, 542 measuring performance. See performance measurement modeling, 80–83 MEDIUMTEXT, 164 modes, SQL, 201–211 memcached modulus operator (%), 503–504 scalability, 747 Monit, 643–644 using, 434–438 monitoring systems memory commercial, 644–646 buffers, 356–357 open source, 636–644 choosing hardware, 349–352 overview, 633–634 command, 57–58 with SQL Administrator, 78–79 Falcon parameters, 407 summary, 646–647 Falcon storage engine options, 370–371 what to, 634–636

838 Index M

monthly backups, 444 scalability, 744–746 MONyog, 645–646 STATE in PROCESSLIST, 707–708 MSSQL, 206 MySQL Community, 5–6 Multi Version Concurrency Control (MVCC). See MVCC MySQL Data Dictionary (Multi Version Concurrency Control) CHARACTER_SETS, 695–696 Multifunctional database, 33 COLLATION_CHARACTER_ multi-master replication, 537–539 SET_APPLICABILITY, 696–697 multiple index scans, 599–600 COLLATIONS, 696 multiple slaves, 534–535 COLUMN_PRIVILEGES, 712–713 multiple SQL statements COLUMNS, 676–679 in events, 293 COMMAND in PROCESSLIST, 699–700 in stored routines, 261 defining plugins, 716–722 in triggers, 245–246 displaying permissions, 711–712 Munin, 642–643 ENGINES, 697 mutex test mode, 557–559 EVENTS, 691–693 MVCC (Multi Version Concurrency Control) GLOBAL_STATUS, 711 Falcon features, 401 GLOBAL_VARIABLES, 710 InnoDB support, 384 KEY_COLUMN_USAGE, 682–684 isolation levels, 335 overview, 667–668 my.cnf,29 PARAMETERS, 690–691 my.ini, 23, 29 PARTITIONS, 693–695 MyISAM plugin compilation, 722–723 Archive and, 417–418 plugin installation, 724–725 backup with mysqlhotcopy, 462–463 PLUGINS, 697–698 copying databases to backup, 467 PROCESSLIST, 698–699 storage engine options, 365–366 PROFILING, 709–710 understanding, 378–384 REFERENTIAL_CONSTRAINTS, 684 myisam_ftdump, 382–383 ROUTINES, 686–690 myisamchk, 381 SCHEMA_PRIVILEGES, 714–715 myisampack, 381–382 SCHEMATA, 668–670 MySQL SESSION_STATUS, 711 access. See accessing MySQL SESSION_VARIABLES, 710 caching with. See caching STATE in PROCESSLIST, 701–709 defined, 52–62 STATISTICS, 679–681 deviations. See deviations storage engine-specific metadata, 716 DRBD and, 738–739 summary, 725 extensions. See extensions TABLE_CONSTRAINTS, 681–682 introduction, 3–7 TABLE_PRIVILEGES, 713–714 language structure. See language structure TABLES, 670–674 objects, 664–665 TRIGGERS, 685–686 resources, 813–820 USER_PRIVILEGES, 715–716 securing. See securing MySQL VIEWS, 674–676 vs. SQL, 87–88 MySQL Enterprise, 5–6 MySQL 5.1 Cluster DBA Certification Study Guide MySQL Enterprise Monitoring, 644–645 (Stephens, Kruckenberg, Bouman and Smith), MySQL Proxy 744 changing and injecting queries, 764–766 MySQL Administrator, 74–80 changing query backend, 763–764 MySQL Backup, 460–462 constants, 766–771 MySQL Cluster high availability with, 739–742 defined, 417 internal structures, 771–772 partitioning with, 513–514 keyword tokens, 774–782

839 M Index

MySQL Proxy (continued) Lua basics, 757–763 N Nagios, 636–637 overview, 749–750 named commands, 56 proxy tokens, 772–774 namespaces, 242 summary, 782 naming understanding, 750–756 case-sensitivity and, 91 MySQL Query Browser, 71–74 charsets and collations, 100 MySQL Reference Manual, 817 conditions, 281 MySQL server tuning dot notation, 95–97 dynamic variables, 371–372 foreign key constraints, 232–233 Falcon storage engine options, 370–371 indexes, 223–224 InnoDB storage engine options, 367–370 limitations and quoting, 93–95 Maria storage engine options, 371 stored routines, 271–273 MyISAM storage engine options, 365–366 native backup drivers, 461–462 operating system, 352–360 NDB storage engine optimal hardware, 349–352 partitioning with MySQL Cluster, 513–514 option file, 361–364 understanding, 417 overall options, 364–365 networking configuration, 34 status variables, 360–361 Networks, Storage Area. See SANs (Storage Area summary, 373 Networks) system variables, 361 NEW.field, 244 MySQL Stored Procedure Programming (Harrison), NO ACTION 282 , 234 MySQL views no data access strategy, 605 NO_AUTO_CREATE_USER abstraction and simplification, 307–308 , 206 changing definitions, 316–317 NO_AUTO_VALUE_ON_ZERO, 206 definer specification, 306–307 NO_BACKSLASH_ESCAPES, 206 defining, 302–303 NO_DIR_IN_CREATE, 206 definition limitations and unexpected behavior, NO_ENGINE_SUBSTITUTION, 206 304–305 NO_FIELD_OPTIONS, 206 overview, 301 NO_KEY_OPTIONS, 207 performance, 308–313 NO_TABLE_OPTIONS, 207 replication and, 317–318 NO_UNSIGNED_SUBTRACTION, 207 security and privacy, 305–306 NO_ZERO_DATE, 207 summary, 318 NO_ZERO_IN_DATE updatable, 313–316 , 207–209 MySQL Workbench, 80–83 nodes, data, 744–746 Noinstall archive package, 21 MYSQL323, 206 Noinstall Zip Archive MYSQL40, 206 configuration file, 31 mysqladmin ,62–66 installing MySQL from, 24–25 mysqlbinlog non-deterministic stored routines, 266–267 defined, 471 non-index schema changes, 626–628 options, 519 non-interactive modes, 54–55 replication and, 528–529 non-SELECT statements, 614 mysqldump, 446–450 non-SQL commands, 56 mysqldumpslow, 583–584 Non-Transactional database only, 33 mysqlhotcopy, 462–463 nonunique index values, 600 mysqlreport, 572–580 non-Windows mysqlslap, 547–552 connecting to machine, 51–52 mysqltuner, 568–572 mysql commands, 57–59

840 Index O

NOT NULL configuration options, 34 character string type attributes, 164–165 test mode, 561–565 datetime type attributes, 191–192 ON COMPLETION, 296–297 ENUM and SET attributes, 198 one read slaves, 729 numeric type attributes, 177 one-way hashes, 656–657 using, 211–212 online backups, 460–462 NOT operator, 205 online statements, 115 notation, dot, 95–97 online transaction processing (OLTP) NULL configuration options, 34 BIT and, 784 test mode, 561–565 character string type attributes, ONLY_FULL_GROUP_BY, 209–210 164–165 open files, 357–358 datetime type attributes, 191–192 open source ENUM and SET attributes, 198 monitoring systems, 636–644 no data access strategy, 605–606 MySQL as, 4 nullable index values, 600 open tables, 142 numeric type attributes, 177 opening cursors, 287 quoting and, 94–95 OpenNMS, 640–641 using, 211–212 operating systems numbers access and security, 654–656 binary collations, 98–100 LVM, 455–460 naming limitations and quoting, 94–95 Mac OS. See Mac OS numeric types tuning, 352–360 and datetime types, 188–190 Windows. See Windows defined, 170–180 operators functions and operators, 795–797 bitwise, 784–787 comparison, 106–107, 789–791 numeric, 795–797 O SQL mode definition, 210 object catalog OPTIMIZE TABLE COLUMNS, 676–679 defined, 154–155 EVENTS, 691–693 query analysis, 615 KEY_COLUMN_USAGE, 682–684 optimizing queries. See query optimization PARAMETERS, 690–691 option files PARTITIONS, 693–695 defined, 29 REFERENTIAL_CONSTRAINTS, 684 Falcon storage engine options, 370–371 ROUTINES, 686–690 InnoDB storage engine options, 367–370 SCHEMATA, 668–670 Maria storage engine options, 371 STATISTICS, 679–681 MyISAM storage engine options, 365–366 TABLE_CONSTRAINTS, 681–682 overall options, 364–365 TABLES, 670–674 server tuning, 361–364 TRIGGERS, 685–686 options VIEWS, 674–676 command-line tool, 49–53 objects vs.commands,56 changed databases and, 59 connectivity, 655 data security using MySQL, 664–665 extension. See extensions views. See MySQL views ibbackup, 465 offline statements, 115–116 I/O test mode, 555–556 OLD.field, 244 memcached, 435 old-password,64 memory test mode, 559 OLTP (online transaction processing) mk-query-profiler, 581–582

841 O Index

options (continued) configuration. See configuration MySQL Proxy backends, 751–755 index length, 226–228 mysqladmin,62–66 InnoDB log files, 393–394 mysqlbinlog, 471, 519 invoking stored procedures, 259–260 mysqldump, 448–449 kernel, 357 mysqldumpslow, 583 master/master replication, 735 mysqlhotcopy, 463 mysqladmin,63–66 mysqlreport, 573 slave promotion, 732 mysqlslap, 548–551 stored procedure, 257 OLTP test mode, 561–563 stored routine recursion, 284–285 stored routine, 265–268 swap memory, 359 SysBench, 553–554 parent tables, 234 thread test mode, 560–561 parsers, 239 OR operator, 210 partial index scans, 598–599 ORACLE, 210 partitioning order dependency, 541 composite, 504–507 index, 225–226 file system snapshots, 451–452 of precedence, 29–30 file systems, 353–356 ORDER BY HASH, 503–504 DML extensions, 120 KEY, 504 optimizing away Using temporary, 620–622 LIST, 502–503 UNION, 127 LVM, 456–459 view definition unexpected behavior, 304 management commands, outputs 507–510 display, 61–62 MERGE, 510–513 Lua functionality, 759 MySQL Cluster, 513–514 monitoring, 634 overview, 495–496 MySQL Proxy, 756 programmatic, 514 Performance Metrics, 570–572 RANGE, 497–502 slow query log, 521 restrictions, 510 stored routine options, 266–267 SAN, 737 stored routines, events and triggers, 242 summary, 514–515 variables, 257 table definition extensions, 149 tables, 496–497 PARTITIONS, 693–695 P passwords PACK_KEYS, 149 client tool options, 53–54 packages command-line tool options, 50 MySQL installation, 13–20 configuration on Unix, 37–39 proxy tokenizer, 760–763 managing user. See user management packed tables, 418 PAD_CHAR_TO_FULL_LENGTH, 210 managing with SQL Administrator, 77 mysqladmin pages commands, 63–64 caching, 398 resetting root, 487–490 Falcon parameters, 405 securing system, 40–41 locking, 336, 341 Security Options screen, 35–36 pager feature, 62 table definition extensions, 149 sizing, 408 wildcards and blank values in, 650 PARAMETERS, 690–691 PATH variable configuration, 42–44 parameters PBXT (Prime Base XT), 410–415

842 Index P

performance location, 445 choosing optimal hardware, 349–352 vs. logical backups, 442 implications of stored routines, 256 physical volumes, 455–460 improving with partitions. See partitioning ping,64–65 increasing with buffers, 356–357 PIPE protocol, 51 optimizing queries. See query optimization PIPES_AS_CONCAT, 210 storage engine. See storage engines pkg files, 16–17 tuning server. See MySQL server tuning plan indexes, 606–607 view, 308–313 planning for disasters, 471–472 performance measurement plans, EXPLAIN, 590–595 benchmarking, 546–547 playing back, 322 benchmarking recommendations, pluggable storage engines, 375 565–566 PLUGINS, 697–698 capacity planning, 585 plugins CPU test mode, 554 Cacti, 638 I/O test mode, 555–557 compiling, 722–723 memory test mode, 559–561 defining, 716–722 mk-query-profiler, 580–583 Hyperic HQ, 639–640 mutex test mode, 557–559 installing, 724–725 mysqldumpslow, 583–584 installing PBXT binary, 415 mysqlreport, 572–580 replication, 525 mysqlslap, 547–552 semisynchronous replication, 525–526 mysqltuner, 568–572 SHOW commands, 143 OLTP test mode, 561–565 storage engines as, 376 overview, 545–546 point-in-time restore profiling, 566 with binary logs, 518 SHOW GLOBAL STATUS, 566–568 crash recovery, 468 summary, 585–586 defined, 441 SysBench, 552–553 policies, security, 665 SysBench common options, 553–554 pools SysBench compilation, 565 mirrored, 453–454 Performance Metrics, 570–572 profiling buffer, 579 periodic events, 293–294 portability permissions language structure, 88–90 ACLs, 649–653 SQL mode functions, 204 debugging account problems, 493–494 POSTGRESQL, 210 deviations, 110 post-install configuration, 36–39 managing user. See user management pound (#), 89–90 view definer specification, 306–307 powertool, 69 view security, 305–306 prefixes, index, 226 permissions display preparation COLUMN_PRIVILEGES, 712–713 COMMAND in PROCESSLIST, 700 overview, 711–712 I/O test mode, 556–557 SCHEMA_PRIVILEGES, 714–715 OLTP test mode, 563–565 TABLE_PRIVILEGES, 713–714 SysBench commands, 553 USER_PRIVILEGES, 715–716 presentations on MySQL, 818–820 phantom reads, 332–333 primary keys phpMyAdmin, 69–71 creating and dropping, 231–232 physical backups defined, 219–231 crash recovery, 468 KEY_COLUMN_USAGE, 682–684 defined, 440 partition, 497 file system snapshots, 451–452 TABLE_CONSTRAINTS, 681–682

843 P Index

Prime Base XT (PBXT), 410–415 proxy tokens, 772–774 priorities pruning, partition DML extensions, 119–120 defined, 497 table-level locks, 340–341 RANGE, 500–501 privacy, 305–306 restrictions, 510 privileges pruning, query cache ACLs, 651–653 defined, 429 creating events, 291 minimizing, 433–434 creating triggers, 243 profiling, 576 flushing, 63 punctuation invoking stored procedures, 259 dot notation, 95–97 managing, 77 MySQL Proxy tokens, 773 MySQL deviations, 110 PURGE BINARY LOGS, 523 replication configuration, 539 server maintenance extensions, 130 SHOW commands, 143 Q stored routine, 256 queries user, 483–484. See also user management basic Lua, 758–760 PROCEDURE ANALYSE cache options, 371 defined, 608 caching. See caching function, 211–216 canceling with mysql,59–60 query analysis, 614 changing backend, 763–764 procedures creating with SQLyog, 67–69 SHOW commands, 143 executing non-interactively, 54–55 SHOW CREATE commands, 138 FULLTEXT, 237–239 stored. See stored routines injecting and changing, 764–766 stored procedure results sets, 273–274 logging, 520–522 PROCESSLIST merging with views, 309–310 COMMAND in, 699–700 mysqlslap, 551–552 defined, 698–699 partitioned tables, 501–502 STATE in, 701–709 profiling, 574–575 PROFILING, 709–710 PROFILING system view, 709–710 profiling profiling with mk-query-profiler, 580–583 defined, 545 profiling with mysqldumpslow, 583–584 mk-query-profiler, 580–583 scaling read, 740 mysqldumpslow, 583–584 simplifying with views, 307–308 mysqlreport, 572–580 speeding up lookups with indexes, 221–231 mysqltuner, 568–572 SQL injection, 657–658 overview, 566 tokenized, 762 SHOW commands, 143–146 query analysis SHOW GLOBAL STATUS, 566–568 additional tools, 614–615 programmatic partitioning, 514 data access strategy, 596–606 promoting slaves, 729–734 EXPLAIN, 590–595 properties EXPLAIN EXTENDED, 612–613 ACID compliance, 321–322 EXPLAIN extra, 608–611 stored routine, 285 EXPLAIN on non-SELECT statements, 614 protocols EXPLAIN plan indexes, 606–607 command-line tool options, 51–52 EXPLAIN rows, 607–608 lack of client support for authentication, 491–492 overview, 589–590 Proxy, MySQL, 739–742 subqueries and EXPLAIN, 611–612 proxy servers, 423–424 Query Browser, MySQL, 71–74

844 Index R

query cache READ UNCOMMITTED profiling, 576 behavior, 329–330 server maintenance extensions, 131 defined, 326–328 working with, 427–434 read_query(), 765–766 query cache invalidation read-only defined, 428 master/master replication and, 736 minimizing, 433–434 replication configuration, 539 query optimization slave promotion and, 732 adding indexes, 616–620 reads batching expensive operations, 628–629 dirty, 326, 329–330 with caching. See caching INSERT, 121 factors affecting key usage, 615 profiling. See profiling frequent operations, 629–631 read/write splitting, 742 with indexes, 221–231 scaling with MySQL Proxy, 740 non-index schema changes, 626–628 scaling with replication, 728–737 optimizer hints, 616 REAL_AS_FLOAT, 210 summary, 631 reconfiguration, 31 using index by eliminating functions, 623–626 record cache Using temporary, 620–623 Falcon parameters, 404, 407 Query Toolbar, 71 PBXT, 410–411 question mark (?), 49 records quitting mysql,56 in EXPLAIN plan indexes, 607–608 quoting optimizing away Range checked for each, 620 naming limitations and, 93–95 retrieving one from system table, 605 SQL modes, 204 recovery backups. See backup InnoDB, 393–394 R Maria support for, 371 R1Soft, 466–467 overview, 468–471 RAID (redundant array of independent disks) PBXT, 410 choosing hardware, 350–351 planning for, 471–472 failure and backup, 441–442 root password, 487–488 file system partitions and, 355 with SQL Administrator, 79 RAM (random access memory). See memory random access memory (RAM). See memory transaction, 343–344 range. See length recursive queries, 109 Range checked for each, 620 recursive stored routines, 284–285 RANGE partitioning redo logs defined, 496 defined, 322 working with, 497–502 InnoDB recovery, 393–394 raw backups, 440 recovering transactions, 343–344 RBR (row-based replication), 527–529 redundant array of independent disks (RAID). See RAID RC (Release Candidate), 11–12 (redundant array of independent disks) RDMS (relational database management systems), redundant calculations, 308–309 561–565 redundant indexes, 223–224, 230–231 READ COMMITTED references, 817–818 behavior, 331–332 REFERENTIAL_CONSTRAINTS, 684 defined, 326–328 refreshing, 64 read locks ReiserFS, 355 defined, 336 relational database management systems (RDMS), table-level, 338–340 561–565

845 R Index

relay logs RESTRICT, 234 backing up, 445 restrictions, partitioning, 510 defined, 520 results slave promotion and, 730–731 changing and injecting queries, 764–766 relay slaves, 535–536 DISTINCTROW, 128 Release Candidate (RC), 11–12 query cache, 427–429 RELEASE SAVEPOINT, 323–324 SQL_BUFFER_RESULT, 129 releases stored procedure sets, 273–274 choosing MySQL version, 11–12 utilizing memcached, 434–438 MySQL history, 5 Results Window, 72 upgrading mysqld,45–47 retrieval reloading mysqladmin commands, 64 with indexes. See indexes RENAME USER, 480–481 mysql commands, 58 REPAIR TABLE, 152–154 SQL mode definitions, 210 REPEAT, 283–284 using SHOW, 135–147 REPEATABLE READ reverse engineering, 80–83 behavior, 332–333 REVOKE defined, 326–328 defined, 110 REPLACE user management, 485 EXPLAIN on, 614 roles Merge and, 383 MySQL support, 110 upsert statements, 113–114 privileges and privilege levels, 651–653 replication ROLLBACK backup locations and, 445 defined, 320, 322 COMMAND in PROCESSLIST, 700 recovering transactions, 344 configuration, 529–539 savepoints, 323–324 correcting data drift, 540–543 transactional statement extensions, 158 high availability and scaling with, 728–737 root passwords MySQL views and, 317–318 resetting, 487–490 overview, 524–529 Security Options screen, 35–36 with SQL Administrator, 80 root username, 481 starting and stopping commands, 64 root users, 37–39 STATE in PROCESSLIST, 705–707 rotating logs, 522–524 stored routine, 285–286 ROUTINES, 686–690 summary, 543 routines trigger, 254–255 managing with Query Browser, 73–74 replication farms, 735 privileges, 483 reporting, 572–580 stored. See stored routines requirements row-based replication (RBR), 527–529 encrypted connectivity as, 664 row-level locks foreign key constraint, 235–237 comparing storage engines, 377–378 reserved words, 271–273 profiling, 579–580 resetting master process, 733 rows resetting root password, 487–490 creating events and inserting, 291–292 resetting slave process, 731–732 DISTINCTROW, 128 resources, 813–820 EXPLAIN, 590–595, 607–608 restores InnoDB status, 389 maatkit parallel dump and, 450–451 locking, 336, 341–343 with MySQL Backup, 460–462 replication and views, 317–318 recovering from crashes, 468–471 splitting, 496 with system snapshots, 451–452 table definition extensions, 147–149

846 Index S

row-wise functions, 783–784 language structure. See language structure rpm-based packages, 13–16 Lua functionality, 758–760 R-tree data structures MySQL Proxy, 755–756 defined, 221–222 secondary slave, 525 index types, 229 Secure Sockets Layer (SSL) running command-line tool options, 53 benchmarking recommendations, 566 encrypted connectivity, 659–664 I/O test mode, 556–557 securing MySQL MySQL Proxy, 756 ACLs, 649–653 OLTP test mode, 563–565 backups and logs, 656 SysBench commands, 553 data security, 656–665 System V levels, 43–44 operating system access, 654–656 runtime behavior policies, 665 event, 298–299 server, 40–41 stored routine, 264–265 summary, 666 trigger, 248–252 security cryptographic functions, 788–789 file system partition, 354 S memcached, 436 SANs (Storage Area Networks) running multiple daemons on server, 360 configuration options, 34 stored routine runtime, 265 high availability with, 737–738 with stored routines, 255–256 snapshots, 460 view, 305–306 savepoints, 323–324 view definer specification, 306–307 SBR (statement-based replication), 527–529 Security Options screen scaling configuration, 35–36 with connection pooling, 746–747 defined, 23 memcached, 747 SELECT with MySQL Cluster, 744–746 extensions, 126 with MySQL Proxy, 739–742 LOCK IN SHARE MODE, 128 overview, 727–728 query cache, 427–429 with replication, 728–737 FOR UPDATE, 127 summary, 748 using EXPLAIN and. See EXPLAIN scans, data access strategy, 596–606 view definition limitations, 304–305 scattered files, 433 SELECT INTO OUTFILE, 126–127, 450 Scheduler, Event select_type, 611 caching with, 424–426 semaphores, 389 turning on, 289–290 semi-colon (;), 60 schedulers, I/O, 358–359 semisynchronous replication, 524–529 schedulers, server, 560–561 sending commands, 60–61 Schema Privileges, 77 sequences SCHEMA_PRIVILEGES, 714–715 AUTO_INCREMENT attribute, 177–178 schemas MySQL support, 108 creating with Workbench, 80–83 scanning indexes, 225–226 non-index changes, 626–628 SERIAL DEFAULT VALUE, 179–180 query analysis and, 259–590 serial logs SHOW CREATE commands, 138 configuration, 407–408 SCHEMATA, 668–670 defined, 403 Schwartz, Baron, 540, 638 SERIALIZABLE Script Editor, 71 behavior, 334–335 scripting defined, 326–327

847 S Index

Server Core, 353 SHOW ENGINE PBXT STATUS, 414–415 Server Type screen, 32 SHOW EVENTS, 693 server variables SHOW GLOBAL STATUS general and slow query log management, 521 defined, 566–568 SHOW GLOBAL STATUS, 566–568 Performance Metrics system views, 710–711 , 570–572 server-id, 530 SHOW GRANTS, 485–487 server-level functions, 792–794 SHOW PRIVILEGES, 712 servers SHOW PROFILE, 566 Administrator information, 80 SHOW SLAVE STATUS, 531–533 backing up. See backup SHOW STATUS, 360–361 Community and Enterprise, 5–6 SHOW WARNINGS, 613 connections with SQLyog, 66–67 shutting down, 64–66 maintenance extensions, 129–131 simple replication, 529–533 measuring performance. See performance measurement simplification, view, 307–308 replication. See replication single master and multiple slave setup, 534–535 resetting root password, 487–490 single quotation mark (’), 93 setting characters sets and collation, 101 sizes tuning MySQL. See MySQL server tuning binary data types, 171 Service Options screen datetime type, 184 configuration, 35 ENUM and SET data type, 200 defined, 23 national character string types, 167 services numeric data, 172–176 Administrator control, 80 numeric types, 181–182 MySQL as Windows, 26–29 rotating logs, 523 session variables TEXT, 164 charset and collation, 101 slave servers dynamic, 371–372 backing up, 445 SHOW commands, 147 backing up with mysqldump, 450 SESSION_STATUS, 711 Blackhole storage engine uses, 419–420 SESSION_VARIABLES, 710 choosing optimal hardware, 351 sessions, 109 configuration, 529–539 SET correcting data drift, 540–543 data types, 195–200 disaster recovery and, 443 extensions, 131–135 high availability and scaling with replication, 728–737 SET NULL, 234 Linux-HA heartbeat architecture, 743 SET PASSWORD command, 38 replication, 524–529 sets, character. See character sets summary, 543 sharding table corruptions and, 154 defined, 495 sleep commands, 65–66 with MySQL Proxy, 742 slow query logs programmatic partitioning, 514 defined, 520–522 shared MySQL solutions, 816–817 mysqldumpslow, 583–584 shared nothing architecture, 744 profiling, 567–568 shared tablespaces, 392–393 Smith, Stewart, 744 SHOW snapshots extensions, 135–147 commercial options, 464–467 query analysis, 614 defined, 310 triggers, 252 file system backup, 451–452 SHOW COLUMNS, 109 LVM, 455–460 SHOW ENGINE InnoDB STATUS, 385–390 online backups, 460–462

848 Index S

SAN and Microsoft VSS, 460 defined, 66–67 ZFS, 453–454 encrypted connectivity, 659 sockets Query Browser and, 72 command-line tool options, 51–52 SSL (Secure Sockets Layer) debugging account problems, 492 command-line tool options, 53 Solaris encrypted connectivity, 659–664 backup with ZFS, 453–454 ST_FIELD_INFO, 717 installing MySQL from pkg file, 16–17 stack traces, 518 monitoring. See monitoring systems stale data, 438 tuning, 352–357 Standard Character Set, 35 solid state hard drives, 351 START TRANSACTION sort orders, 98–101 AUTOCOMMIT and, 324–325 source (\.),54–55 defined, 157 source code using, 322 vs. binary file, 10 starting defined, 4 MySQL as Windows service, 26–29 reusing with stored routines, 255 MySQL from Windows command line, 25–26 source MySQL Proxy distributions, 750–751 MySQL on System V-based Unix, 42–43 SPATIAL INDEX times, 293–294 start-slave ALTER TABLE extensions, 116 ,64 STATE in PROCESSLIST, 701–709 index types, 229–230 statement-based replication (SBR), 527–529 speeding up lookups with, 222 statements. See also extensions specifiers, 797–799 CHANGE MASTER, 534 speed combining multiple, 786–787 file systems, 355–356 EXPLAIN. See EXPLAIN increasing with buffers, 356–357 functions. See functions lookup, 221–231 multiple SQL in events, 293 MySQL, 3–4 multiple SQL in stored routines, 261 testing CPU, 554 multiple SQL in triggers, 245–246 splitting, read/write, 742 MySQL Data Dictionary. See MySQL Data splitting rows, 496 Dictionary SQL MySQL Proxy keyword tokens, 774–782 injection, 657–658 replication and views, 317–318 vs. MySQL, 87 SELECT INTO OUTFILE, 450 threads, 525 stored routine flow control, 282–285 SQL modes stored routine usage, 267–268 changing event, 298–299 transaction, 322–325 changing stored routine, 264 upsert, 112–114 changing trigger, 248–249 STATISTICS, 679–681 choosing, 201–211 statistics SQL statements maintaining table, 155–156 multiple in events, 293 mysqltuner, 569–572 multiple in stored routines, 261 status multiple in triggers, 245–246 commands, 65–66 SQL_BIG_RESULT, 127 event, 294–295 SQL_BUFFER_RESULT, 129 server maintenance extensions, 130 SQL_CALC_FOUND_ROWS, 128 SHOW commands, 141 SQL_SMALL_RESULT, 127 SHOW ENGINE InnoDB STATUS, 385–390 SQLyog, 66–69 SHOW ENGINE PBXT STATUS, 414–415 ssh tunneling showing slave, 531–533

849 S Index

status variables table definition extensions, 148 mysqladmin commands, 63–64 transaction management, 110–111 query cache, 431 transaction support, 320 server tuning, 360–361 understanding, 375–378 SHOW GLOBAL STATUS, 566–568 stored procedures Stephens, Jon, 744 results sets, 273–274 stopping ROUTINES system view, 686–690 MySQL as Windows service, 26–29 stored routines MySQL from Windows command line, 25–26 backup and storage, 286–287 MySQL on System V-based Unix, 42–43 changing, 270–271 stop-slave,64 conditions and handlers, 275–281 storage CREATE FUNCTION syntax, 269 caching. See caching creating, 256–257 configuration with Database Usage screen, 33 creating basic stored functions, 268–269 events, 300 dropping, 261 index order, 225–226 errors and warnings, 274–275 MySQL deviations, 106 flow control, 282–284 slow query logs, 520 INOUT arguments, 261–262 stored routine, 286–287 invoking, 259–260 trigger, 252–254 invoking stored functions, 269–270 Storage Engine Statistics, 569–570 local variables, 262–264 storage engines managing with Query Browser, 73–74 Archive, 417–419 naming, 271–273 backing up. See backup options when creating, 265–268 Blackhole, 419–420 overview, 255–256 commands, 421–422 PARAMETERS, 690–691 CSV (Comma Separated Value), 420–421 recursion, 284–285 ENGINES system view, 697 replication and limitations, 285–286 Falcon, 401–409 ROUTINES system view, 686–690 Falcon options, 370–371 runtime behavior, 264–265 FEDERATED, 415–417 stored procedure results sets, 273–274 index types, 228–230 summary, 300 InnoDB, 384–394 triggers, events and, 241–242 InnoDB options, 367–370 using cursors, 287–289 locking and, 343 warnings, 257–259 Maria, 396–401 Strict Mode Options screen, 34 Maria options, 371 strict sql_mode, 201 MEMORY, 394–396 STRICT_ALL_TABLES, 210 MERGE table partitioning, 510–513 STRICT_TRANS_TABLES, 210–211 metadata, 716 strings MyISAM, 378–384 binary large object string types, 168–170 MyISAM options, 365–366 character string types, 160–166 MySQL deviations, 105 concatenation support, 107 NDB, 417 escape sequences, 92 NULL values support, 211 functions, 806–810 partition table restrictions, 510 host, 473–474 partitioning with MySQL Cluster, 513–514 indexes, 226–228 PBXT, 410–415 Lua functionality, 758–759 PRIMARY KEY in, 221 MySQL deviations, 106 SQL mode definitions, 206 naming limitations and quoting, 93–94 summary, 422 national character string types, 166–168

850 Index T

setting characters sets and collation, 102 system information wildcards in host, 650 CHARACTER_SETS, 695–696 subpartitions COLLATION_CHARACTER_ defined, 504–507 SET_APPLICABILITY, 696–697 system view, 693–695 COLLATIONS, 696 subqueries, 611–612 COMMAND in PROCESSLIST, 699–700 subtractions, 207 ENGINES, 697 SUPER privileges, 38 GLOBAL_STATUS, 711 support GLOBAL_VARIABLES, 710 check constraints, 111–112 PLUGINS, 697–698 comparing storage engines, 376–378 PROCESSLIST, 698–699 encrypted connectivity, 659–661 PROFILING, 709–710 finding paid, 813–814 SESSION_STATUS, 711 foreign key constraints, 232 SESSION_VARIABLES, 710 lack of client for authentication protocol, 491–492 STATE in PROCESSLIST, 701–709 MySQL, 12 system tables MySQL deviations, 106–110 initializing, 36–37 NULL values, 211–212 retrieving one record, 605 partition table restrictions, 510 user management, 476–478 privileges and permissions, 110 System V SHOW, 136 run levels, 43–44 storage engine for transactions, 320 starting and stopping MySQL on, 42–43 transaction management, 110–111 system variables upsert statements, 112–114 controlling locks with, 341 surrogate keys, 220–221 Performance Metrics and SHOW GLOBAL swap memory STATUS, 570–572 InnoDB storage engine options, 368 query cache, 430 tuning Linux, 359 semisynchronous replication plug-in, 526–527 sweeper threads, 411 server tuning, 361 synchronization systems with DRBDs, 738–739 counters, 566–568 master-master replication and, 537 file. See file systems with mk-table-sync, 542 INFORMATION_SCHEMA views. See MySQL Data with replication, 524–529 Dictionary replication for, 728–737 monitoring. See monitoring systems SAN, 737–738 setting characters sets and collation, 104 with SQLyog, 69 syntax. See also language structure CREATE FUNCTION, 269 T CREATE PROCEDURE, 268 Tab key, 58–59 SQL modes, 201–211 TABLE_CONSTRAINTS, 681–682 SysBench TABLE_PRIVILEGES, 713–714 common options, 553–554 table-level locks, 377–378 compiling, 565 TABLES, 670–674 CPU test mode, 554 tables I/O test mode, 555–557 adding/dropping indexes, 223–224 memory test mode, 559–561 ALTER TABLE extensions, 115–118 mutex test mode, 557–559 creating Falcon, 409 OLTP test mode, 561–565 creating text files from, 126–127 overview, 552–553 creating with phpMyAdmin, 70 system command, 62 creating/dropping key constraints, 231–237

851 T Index

tables (continued) thawing, 406 definition extensions, 147–150 third-party packages flushing, 63 MySQL Proxy, 750–751 implementing cache, 424–427 problems with, 11 lock priority, 129 threads locking, 336, 338–341 flushing, 63 maintenance extensions, 150–156 profiling, 578 Maria configuration, 398–400 replication and, 524–529 MERGE, 510–513 server maintenance extensions, 130 MySQL deviations, 106 slave promotion and, 730–731 mysqlslap, 551–552 test mode, 560–561 partitioning. See partitioning time privileges, 482 event scheduling, 289–290 query analysis. See query analysis functions, 797–806 scans vs. indexes, 222 start and end times for periodic events, 293–294 server maintenance extensions, 130–131 TIME type, 183–184 setting characters sets and collation, 101 time zones SHOW commands, 146–147 datetime types, 183, 192–193 SHOW CREATE commands, 138 language structure, 97–98 SQL mode definitions, 206–207 TIMESTAMP data type, 183–192 SQL modes, 210–211 TINYINT(1), 180–183 system, 476–478 TINYTEXT, 164 types, 375 tokens views. See MySQL views keyword, 774–782 tablespaces Lua, 760–763 Falcon, 408–409 proxy, 772–774 InnoDB, 384–394 tools target hosts, 467 for accessing MySQL. See accessing MySQL temporary tables optimizing away Using temporary, 620–623 backup, 445–446 profiling, 577 benchmarking. See benchmarking on triggers, 247–248 correcting data drift, 540–543 TEMPTABLE, 310 monitoring. See monitoring systems terminators, 88–89 MySQL Proxy. See MySQL Proxy test modes, SysBench query analysis. See query analysis CPU, 554 query optimization. See query optimization I/O, 555–557 TRADITIONAL, 211 memory, 559–561 training, 820 mutex, 557–559 Transactional database only, 33 OLTP, 561–565 transactions test servers, 443 ACID compliance, 320–322 testing Falcon parameters, 404, 406 functions, 789–792 FEDERATED table limitations, 417 ideas, 620 InnoDB support, 384 TEXT data types isolation levels, 325–335 defined, 160–161 locking and deadlocks, 336–343 functions, 806–810 Maria support for, 371 indexing, 226–227 MySQL deviations, 110–111 sizes, 164 overview, 319–320 text files PBXT configuration, 411–412 creating from database table, 126–127 recovering, 343–344 LOAD DATA INFILE, 122–123 statement extensions, 156–158

852 Index U

statements, 322–325 unique index values, 602–603 storage engine support, 377 unique key constraints summary, 344–345 creating and dropping, 231–232 transform functions, 108 defined, 219–231 transliterations, 108 KEY_COLUMN_USAGE, 682–684 transparent partitioning, 513–514 TABLE_CONSTRAINTS, 681–682 TRIGGERS, 685–686 Unix triggers case-sensitivity, 90–91 caching with, 427 configuration file, 31 changing, 246–247 debugging account problems, 492 creating, 243–244 installing MySQL from archive package, data security using, 664–665 18–20 dropping, 244–245 installing MySQL on, 13–20 finding all, 252 monitoring. See monitoring systems multiple SQL statements in, 245–246 post-install configuration on, 36–39 overview, 242–243 resetting root password, 489–490 replication and limitations, 254–255 starting and stopping MySQL on System-V based, runtime behavior, 248–252 42–43 SHOW commands, 147 unlocking, 338–340 SHOW CREATE commands, 138 UNSIGNED, 178 storage and backup, 252–254 UPDATE stored routines, events and, 241–242 DML extensions, 120 summary, 300 EXPLAIN on, 614 using cursors, 287–289 foreign key constraints and, 234 on views and temporary tables, 247–248 invoking triggers, 242–243 troubleshooting upsert statements, 112–114 foreign key constraints, 235–237 updating MySQL server, 47–48 datetime types, 187–188 TRUE,95 indexes, 223 truncation keys and indexes, 220 error handling, 275–281 memcached, 438 stored routine warning, 257–259 SERIALIZABLE isolation levels and, 334–335 TRUNCATE, 120 view, 313–316 tuning MySQL servers. See MySQL server tuning upgrading mysqld, 45–47, 257 tuning query caches, 429–433 upsert statements tunneling, ssh. See ssh tunneling DML extensions, 120 type, 596–606 MySQL deviations, 112–114 types, data. See data types use (\u),57 types, index. See index types user management Typical installation, 21–22 accounts, 478–487 debugging account problems, 490–494 learning about, 473–478 U resetting root password, 487–490 \u (use),57 summary, 494 UDFs (user-defined functions), 241–242 USER_PRIVILEGES, 715–716 UFS (Unix file system), 355 user-defined functions (UDFs), 241–242 undo logs, 343–344 user-defined types, 108 UNION user-defined variables, 131–135 EXPLAIN and, 591–592 usernames MERGE tables, 512–513 command-line tool options, 50 ORDER BY, 127 managing. See user management table definition extensions, 150 wildcards and blank values in, 650

853 U Index

users local in stored routines, 262–264 changing event, 299 mysqladmin commands, 64 changing stored routine, 264–265 Performance Metrics and SHOW GLOBAL changing trigger, 250–252 STATUS, 570–572 group meetings, 819 in server option file. See option files managing with SQL Administrator, 77 server status, 360–361 MySQL community, 6–7 server system, 361 privileges and privilege levels, 651–653 SET extension and user-defined, 131–135 resources, 130 setting characters sets and collation, 101–104 Security Options screen, 35–36 SHOW commands, 147 Using filesort, 618–620 SQL modes, 201 Using temporary, 620–623 system views, 710–711 utf8 character set vendor-supplied packages, 11 charsets and collations, 100 versions defined, 93 choosing MySQL, 11–12 index length, 227 command-line tool options, 53 utilities, MyISAM, 380–381 end of life, 569 mysqladmin commands, 64 upgrading mysqld,45–47 V vertical partitioning, 496 validation, 656–665 viewing values events, 295 assigning to user-defined variables, 131–135 triggers, 252 BLOB, 169 VIEWS, 674–676 coercibility, 811 views COMMAND in PROCESSLIST, 699–700 EXPLAIN and, 591 data access strategy, 600–603 INFORMATION_SCHEMA datetime types, 185–187 database system. See ENUM and SET data types, 198–200 MySQL Data Dictionary enumerations, 195–197 MySQL. See MySQL views SHOW CREATE EXPLAIN Extra, 609–611 commands, 139 key constraints. See key constraints on triggers, 247–248 mysqldumpslow, 583–584 visitor count caching, 424–427 NOT NULL. See NOT NULL volume groups, 455–460 NULL. See NULL Volume Shadow Copy Service (Microsoft VSS), 460 partitioning algorithms, 496–497 STATE in PROCESSLIST, 701–709 stored routine SQL usage, 267–268 W subquery for select_type, 611 warm backups type, 597 defined, 441 VARBINARY, 170 tools, 446 VARCHAR warnings defined, 160–161 creating events, 292 length, 163–164 logging, 518 sizing, 608 SHOW commands, 147 variable-length strings SQL modes, 201–203 binary data types, 171 stored routine, 257–259, 274–275 character string types, 160–161 trigger, 245 national character string types, 166 weekly backups, 444 variables WHERE benchmarking recommendations, 565–566 optimizing by eliminating functions, 625–626 InnoDB configuration, 384–385 SHOW and, 136

854 Index Z

WHILE, 283 wrappers, 450–451 Widenius, Michael, 4 wrappers, transaction, 320 wildcard characters write locks in ACLs, 650 defined, 336–337 defined, 475–476 row-level, 341–342 Windows table-level, 339–341 case-sensitivity, 91 writes, profiling. See profiling configuration file, 31 Configuration Wizard on, 31–36 connecting to non-Windows machine, 51–52 X copying databases to backup, 467 XFS, 355 installing MySQL on, 20–24 XML (eXtensible Markup Language) monitoring. See monitoring systems functions, 812 mysql commands, 57–58 LOAD XML INFILE, 123–124 PATH variable configuration, 42–44 resetting root password, 488–489 starting and stopping from as service, 26–29 Y starting and stopping from command line, 25–26 yanking, 58 tuning, 352–357 YEAR data type, 183–184 mysqld upgrading ,46–47 YEAR_MONTH data type, 193–194 WITH CHECK OPTION simulating check constraints in views, 310–312 on views that reference other views, 312–313 Wizards Z Zenoss Core, 641–642 Configuration, 31–36 zero dates, 207–209 installation, 20–24 ZEROFILL, 179 Workbench, MySQL, 80–83 ZFS, 355, 453–454 working sets, 350 Zmanda, 466 wrapper tables, 383–384

855