Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorVinicius M. Grippa, Sergey Kuzmichev

Get a comprehensive overview on how to set up and design an effective database with MySQL. This thoroughly updated edition covers MySQL's latest version, including its most important aspects. Whether you're deploying an environment, troubleshooting an issue, or engaging in disaster recovery, this practical guide provides the insights and tools necessary to take full advantage of this powerful RDBMS. Authors Vinicius Grippa and Sergey Kuzmichev from Percona show developers and DBAs methods for minimizing costs and maximizing availability and performance. You'll learn how to perform basic and advanced querying, monitoring and troubleshooting, database management and security, backup and recovery, and tuning for improved efficiency. This edition includes new chapters on high availability, load balancing, and using MySQL in the cloud. Get started with MySQL and learn how to use it in production Deploy MySQL databases on bare metal, on virtual machines, and in the cloud Design database infrastructures Code highly efficient queries Monitor and troubleshoot MySQL databases Execute efficient backup and restore operations Optimize database costs in the cloud Understand database concepts, especially those pertaining to MySQL

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, production-oriented guide to MySQL 8.0 for developers and DBAs, covering everything from installation and database design to advanced querying, monitoring, high availability, and cloud deployment—ideal for anyone who wants to run MySQL reliably at scale. 【Book Arc】 - **Opening (~0%–9%)**: Covers MySQL 8.0 installation on Linux, macOS, and Windows, including package managers, systemd, and initial security setup. Also introduces the MySQL data directory layout and key files like `ibdata1` and the socket file. - **Early (~9%–25%)**: Moves into database design fundamentals—entity-relationship modeling, primary keys, normalization (1NF through 6NF), and practical schema creation. Includes tools like `dbdeployer` for testing multiple MySQL versions and guidance on upgrading servers safely. - **Early (~25%–38%)**: Focuses on basic and intermediate SQL querying: `SELECT` with `WHERE`, `ORDER BY`, `LIMIT`, joins, and data manipulation (`DELETE`, `UPDATE`). Uses the `sakila` sample database for hands-on examples. - **Middle (~38%–53%)**: Delves into data types (integers, `BIGINT`, `ZEROFILL`), naming conventions, and case-sensitivity rules across operating systems. Also covers database creation pitfalls, reserved words, and practical tips for writing portable SQL. - **Late (~53%–end)**: Shifts to operational concerns: monitoring with status variables, the slow query log, InnoDB engine reports, and investigation methods (USE/RED). Concludes with high availability via asynchronous replication, backup/recovery (including point-in-time recovery with XtraBackup and mysqldump), and cloud cost optimization. 【Key Takeaways】 - **Installation is platform-specific but well-documented** (Early): The book walks through MySQL 8.0 setup on Linux (apt/yum), macOS (brew), and Windows, including systemd integration and `mysql_secure_installation`. Expect step-by-step commands, not just theory. - **Understanding the data directory prevents common mistakes** (Early): Files like `ibdata1`, the `mysql` system schema, and the socket file have specific roles. Knowing what lives where helps with troubleshooting and security (e.g., disabling remote TCP by setting `bind-address` to `127.0.0.1`). - **Database design is about modeling reality, not just writing SQL** (Early): Entity-relationship diagrams, primary key selection (including artificial keys like product IDs), and normalization forms (UNF to 6NF) are covered with concrete examples. The key insight: attributes that vary by context (e.g., price per market) need separate modeling. - **SQL querying is taught through the `sakila` sample database** (Early–Middle): Practical examples show how to filter with `WHERE`, sort with `ORDER BY`, limit results with `LIMIT`, and join tables. A useful tip: when sorting, add more columns to `ORDER BY` to avoid undefined order for duplicate values. - **Data types have real storage and performance implications** (Middle): `INT` widths don't constrain range, `BIGINT` is needed for billions of rows, and `ZEROFILL` auto-adds `UNSIGNED`. Internal calculations use signed `BIGINT` or `DOUBLE`, so be cautious with extremely large unsigned numbers. - **Naming conventions and case-sensitivity vary by OS** (Middle): `lower_case_table_names` behaves differently on Windows (default 1), macOS (default 2), and Linux (forces 0). Consistent lowercase naming is recommended for portability; avoid reserved words or use backticks at your own risk. - **Monitoring is a core skill for production DBAs** (Late): The book covers status variables, the slow query log, InnoDB engine status, and the USE/RED methods for investigation. Tools like `pt-stalk` help collect MySQL and OS metrics during incidents. - **High availability and backup are intertwined** (Late): Asynchronous replication setup is detailed, and point-in-time recovery is demonstrated with both XtraBackup and mysqldump. The book emphasizes testing upgrades and recovery procedures before production use. 【Reading Tips】 - **Skim installation chapters if you're experienced** (Early): The first ~25% is heavy on platform-specific commands. If you already have MySQL running, jump to the design and querying sections, but revisit the data directory explanation—it's foundational for troubleshooting. - **Deep-read the database design chapter** (Early): Normalization and ER modeling are explained with clear examples. This is where you'll build mental models for schema design that pay off in later chapters on querying and performance. - **Practice queries with the `sakila` database** (Early–Middle): The book uses it extensively. Set it up early and run the examples yourself—this is the fastest way to internalize `WHERE`, `JOIN`, and `LIMIT` behavior. - **Pay attention to data type discussions** (Middle): The differences between `INT`, `BIGINT`, and `ZEROFILL` seem minor but matter for storage and correctness. Skim the width discussion but note the unsigned range limits. - **Use the monitoring and HA chapters as reference** (Late): These are dense with operational detail. Read them once for context, then return when you need specific commands or configuration parameters for replication or backup. 【Coverage Limits】 The excerpts cover installation, design, querying, data types, and operational topics (monitoring, HA, backup) but do not include detailed coverage of advanced performance tuning, security hardening beyond initial setup, or cloud-specific deployment walkthroughs—those sections are referenced but not fully excerpted.
Page 12
dump 402 Exporting and Importing InnoDB Tablespaces 402 Technical Background 403 Exporting a Tablespace 403 Importing a Tablespace 405 XtraBackup Single-Tabl...
View in text
Excerpt 2
tered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. 32 | Chapter 1: Installing MySQL innod...
View in text
Excerpt 3
onal dependencies of nonprime attributes on candidate keys) Every nontrivial functional dependency No No No Yes Yes Yes Yes begins with a superkey or ends wi...
View in text
Excerpt 4
ver version for the right syntax to use near 'cy' at line 1 Since more than one SQL statement can be on a single line, the result is that a data‐ base lu is...
View in text
Excerpt 5
types, but when a table’s storage engine is not specified, you can assume that all indexes are B-trees. Having a clustered index, or in other words having in...
View in text
Excerpt 6
ZHIVAGO CORE | 2005-06-17 03:19:20 | 2005-06-21 00:19:20 | | ZHIVAGO CORE | 2005-06-18 06:46:54 | 2005-06-26 09:48:54 | 204 | Chapter 5: Advanced Querying If...
View in text
Excerpt 7
1 row in set (0.01 sec) This SELECT query still returns the old data for account 1, with a balance of 80 USD, even though transaction 1 changed it to 70 USD...
View in text
Excerpt 8
last_name = 'Guiness'; Query OK, 2 rows affected (0.00 sec) The first variant is almost identical to our previous example, except it includes the optional IN...
View in text
Tags
AI categories
DatabaseSQLBackend
ISBN: 1492085928
Publisher: O'Reilly Media
Publish Year: 2021
Language: English
Pages: 632
File Format: PDF
File Size: 15.5 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…