рдореБрдЦреНрдп рдордЬрдХреБрд░рд╛рдХрдбреЗ рдЬрд╛
JobCannon
рд╕рд░реНрд╡ рдХреМрд╢рд▓реНрдпреЗ

MySQL

The world's most popular open-source relational database

тмв рд╢реНрд░реЗрдгреА 2рддрд╛рдВрддреНрд░рд┐рдХ
+$10k-
рдкрдЧрд╛рд░рд╛рд╡рд░реАрд▓ рдкрд░рд┐рдгрд╛рдо
4 рдорд╣рд┐рдиреЗ
рд╢рд┐рдХрдгреНрдпрд╛рд╕ рд▓рд╛рдЧрдгрд╛рд░рд╛ рд╡реЗрд│
рд╕реЛрдкреЗ
рдХрд╛рдард┐рдгреНрдп
3
рдХрд░рд┐рдЕрд░реНрд╕
рдПрдХрд╛ рджреГрд╖реНрдЯрд┐рдХреНрд╖реЗрдкрд╛рдд

MySQL is the default database for LAMP/LEMP stack applications, powering WordPress and millions of web services. Career path: Developer (schema design, basic indexing, $95-130k) тЖТ DBA (replication, performance tuning, backup strategies, $120-160k) тЖТ Senior DBA (cluster architecture, Vitess scaling, multi-datacenter failover, $160-210k). Salary premium: $15-30k above backend developer baseline. Tools: MySQL, InnoDB, Workbench, ProxySQL, MyDumper, Percona Server, Aurora, MysqlBinlog. Competes with PostgreSQL (complex queries) and MongoDB (document storage) but wins on read performance and ecosystem maturity.

MySQL рдореНрд╣рдгрдЬреЗ рдХрд╛рдп

MySQL powers a massive portion of the web, from WordPress to Facebook. Known for its simplicity, speed, and reliability, MySQL is the default database for LAMP stack applications and remains heavily used in e-commerce, content management, and SaaS platforms. MySQL 8.0+ brought significant improvements including window functions, CTEs, JSON support, and improved security. While PostgreSQL is often preferred for complex queries, MySQL's read performance and vast ecosystem keep it relevant.

ЁЯФз рд╕рд╛рдзрдиреЗ рдЖрдгрд┐ рдкрд░рд┐рд╕рдВрд╕реНрдерд╛
MySQLInnoDB Storage EngineMySQL WorkbenchProxySQLMyDumperPercona ServerAWS Aurora MySQLVitessMySQL Group ReplicationMysqlBinlogPerformanceSchema

ЁЯУЛ рд╕реБрд░реВ рдХрд░рдгреНрдпрд╛рдкреВрд░реНрд╡реА

ЁЯТ░ рдкреНрд░рджреЗрд╢рд╛рдиреБрд╕рд╛рд░ рдкрдЧрд╛рд░

рдкреНрд░рджреЗрд╢рдЬреНрдпреБрдирд┐рдпрд░рдордзреНрдпрдорд╕реАрдирд┐рдпрд░
USA$95k$140k$190k
UK┬г60k┬г90k┬г130k
EUтВм65kтВм95kтВм140k
CANADAC$100kC$150kC$210k

ЁЯОп MySQL рд╡рд╛рдкрд░рдгрд╛рд░реА рдХрд░рд┐рдЕрд░

тЪЦ рдпрд╛рдВрдЪреНрдпрд╛рд╢реА рддреБрд▓рдирд╛ рдХрд░рд╛

тЭУ FAQ

MySQL vs PostgreSQL, which should I learn?
MySQL: read-heavy, LAMP ecosystem, simpler administration, 90% of web servers, better for high-traffic CRUD apps, no complex analytics. PostgreSQL: complex queries (CTEs, recursive), advanced data types (JSON, arrays), ACID without compromise, analytics queries, but requires more tuning and bigger ops team. Learn MySQL first if building web apps, PostgreSQL if building data platforms.
InnoDB vs MyISAM, which storage engine?
Always use InnoDB (default in MySQL 5.7+). MyISAM is obsolete: no transactions, no crash recovery, full table locks (kills concurrency). InnoDB has: ACID compliance, row-level locking, crash-safe replication, foreign keys, and modern query optimization. MyISAM only survives in legacy systems; never use for new projects.
How do I set up replication and handle failover?
Master-Slave replication: slave reads binary log from master and replays SQL. Setup: enable binary logging on master, create replication user, run `CHANGE MASTER` on slave. Failover: promote slave to master (manual or via MHA/Orchestrator automation). Best practice: use Group Replication for automatic failover without coordinator, or Percona XtraDB Cluster for synchronous replication. Monitor replication lag (`SHOW SLAVE STATUS`).
How do I scale a single MySQL server horizontally?
Three approaches: (1) Read replicas: distribute SELECT traffic across slaves (same schema), all writes go to master. Slow queries and analytics on replicas. (2) Sharding (horizontal partitioning): split data by key (user_id % shard_count), each shard is separate DB. Complex but true horizontal scale. Need application logic to route queries. (3) Vitess (proxy layer): MySQL sharding + routing + auto-resharding without app changes. Recommended for 100GB+ datasets.
When should I NOT use MySQL?
Don't use MySQL for: (1) unstructured/nested data (use MongoDB), (2) complex analytical queries across 100B+ rows (use Redshift/BigQuery), (3) real-time graph queries (use Neo4j), (4) <1MB datasets (use SQLite), (5) strict SERIALIZABLE consistency (use PostgreSQL). MySQL shines at web application data (user accounts, orders, content), not analytics or documents.
How do I optimize slow queries?
Enable slow query log: set `long_query_time=1` in my.cnf. Use `EXPLAIN` to find missing indexes or bad join orders. Key rules: (1) index WHERE + JOIN columns, (2) index prefix for LIKE queries, (3) avoid OR conditions (use UNION instead), (4) denormalize read-heavy tables, (5) use query caching or Redis for repeated results. Use `pt-query-digest` to analyze slowlog patterns.
What's the difference between UTF8 and UTF8MB4?
UTF8 in MySQL is broken: only 3 bytes max, can't store emoji or rare unicode. UTF8MB4 is real UTF-8: 4 bytes, stores any character. Always use UTF8MB4 for new databases: `ALTER DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;` and for new tables. Collation: use `utf8mb4_unicode_ci` (case-insensitive) for user-facing strings, `utf8mb4_bin` for case-sensitive (passwords, identifiers).

рд╣реЗ рдХреМрд╢рд▓реНрдп рддреБрдордЪреНрдпрд╛рд╕рд╛рдареА рдпреЛрдЧреНрдп рдЖрд╣реЗ рдХрд╛, рдпрд╛рдЪреА рдЦрд╛рддреНрд░реА рдирд╛рд╣реА?

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдЖрдореНрд╣реА рдпреЛрдЧреНрдп рдорд╛рд░реНрдЧ рд╕реБрдЪрд╡реВ.

рдорд╛рдЭреНрдпрд╛рд╕рд╛рдареА рд╕рд░реНрд╡реЛрддреНрддрдо рдХреМрд╢рд▓реНрдпреЗ рд╢реЛрдзрд╛ тЖТ

рддреБрдордЪрд╛ рдЖрджрд░реНрд╢ рдХрд░рд┐рдЕрд░ рдорд╛рд░реНрдЧ рд╢реЛрдзрд╛

реи,релреирез рдХрд░рд┐рдЕрд░рдордзреНрдпреЗ рдХреМрд╢рд▓реНрдпрд╛рдВрд╡рд░ рдЖрдзрд╛рд░рд┐рдд рдЬреБрд│рдгреА. рдореЛрдлрдд, ~3 рдорд┐рдирд┐рдЯреЗ.

рдХрд░рд┐рдЕрд░ рдореЕрдЪ рдХрд░реВрди рдкрд╛рд╣рд╛ тАФ рдореЛрдлрдд тЖТ