---
title: "Migrating Facebook to MySQL 8.0"
description: "Facebook moved its MySQL fleet from a heavily customized 5.6 branch straight to 8.0, skipping 5.7."
url: "https://swe.quest/articles/migrating-facebook-to-mysql-8-0-5af9e565f1e50eea"
canonical: "https://engineering.fb.com/2021/07/22/data-infrastructure/mysql/"
source: "Meta Engineering"
published: "2021-07-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 11
tags: ["mysql","schema-migrations","replication","refactoring","testing"]
---

# Migrating Facebook to MySQL 8.0

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2021-07-22, 11 min read, Case study. Original: [https://engineering.fb.com/2021/07/22/data-infrastructure/mysql/](https://engineering.fb.com/2021/07/22/data-infrastructure/mysql/)

## Summary

Facebook moved its MySQL fleet from a heavily customized 5.6 branch straight to 8.0, skipping 5.7. Over a couple of years the team evaluated more than 2,300 patches and ported about 1,500. Each replica set was moved independently by adding 8.0 secondaries via mysqldump, promoting them and then removing the 5.6 instances, with config-driven automation and per-replica-set rollback. Problems found along the way included utf8mb4\_0900 collation mismatches, new reserved keywords like groups and rank, InnoDB deadlocks fixed by lowering isolation after standardizing on row-based replication, ACL cache and binlog index mutex contention, and higher memory use that required trimming performance\_schema and InnoDB structures.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [MySQL](https://swe.quest/tags/mysql.md) (Data & databases)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- MySQL replication ([easy posts on MySQL](https://swe.quest/tags/mysql.md?difficulty=easy))
- InnoDB basics
- primary/secondary replica sets

## Keywords

MySQL 8.0, MySQL 5.6, MyRocks, InnoDB, row-based replication, performance\_schema, utf8mb4

## Related posts

- [Upgrading GitHub.com to MySQL 8.0](https://swe.quest/articles/upgrading-github-com-to-mysql-8-0-2c7892d15b6d7ff3.md): GitHub Engineering · 2023-12-07 · Medium · 11 min read · MySQL, Replication, Deployment, Databases
  GitHub upgraded 1200+ MySQL hosts (300+ TB, 5.5M QPS, 50+ clusters, including Vitess) from 5.7 to 8.0 over more than a year without breaking SLOs.
- [Upgrading MySQL at Shopify](https://swe.quest/articles/upgrading-mysql-at-shopify-bb0f87b54fe985d5.md): Shopify Engineering · 2021-12-02 · Hard · 16 min read · MySQL, Replication, Debugging, Deployment, Cloud platforms
  Shopify moved hundreds of horizontally sharded Percona Server shards, thousands of VMs in all, from 5.7.21 to 5.7.32, mainly to get writeset-based replication parallelism across replication topologies up to four hops deep.
- [Partitioning GitHub’s relational databases to handle scale](https://swe.quest/articles/partitioning-github-s-relational-databases-to-handle-scale-7b5ea75acfc088c0.md): GitHub Engineering · 2021-09-27 · Medium · 9 min read · MySQL, Distributed databases, Scaling, Schema migrations, Ruby
  GitHub split its monolithic \`mysql1\` MySQL cluster by first virtually partitioning tables into schema domains (declared in YAML) and enforcing boundaries with query and transaction linters, then physically moving domains to new clusters via Vitess vertical sharding or a custom ProxySQL/GTID-based write-cutover script.
- [Beyond synthetic testing: Capturing and replaying real database workloads at Airbnb](https://swe.quest/articles/beyond-synthetic-testing-capturing-and-replaying-real-database-workloads-at-ad8d4a3a0c1cef6e.md): Airbnb Engineering · 2026-10-06 · Medium · 11 min read · MySQL, Testing, Capacity planning, Performance engineering, Databases
  Airbnb replaced fragmented per-language client-side query logging with a client-agnostic capture point in ProxySQL, so real production MySQL traffic can be replayed offline.
- [Shard Balancing: Moving Shops Confidently with Zero-Downtime at Terabyte-scale](https://swe.quest/articles/shard-balancing-moving-shops-confidently-with-zero-downtime-at-terabyte-scale-76a6177fa357eea4.md): Shopify Engineering · 2021-09-24 · Medium · 13 min read · MySQL, Distributed databases, Schema migrations, Scaling
  Shopify rebalances its MySQL shards by moving individual shops between pods online, with downtime confined to a brief cutover.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
