MariaDB started in 2009 as a fork of MySQL 5.1, promising to be a drop-in replacement: same protocol, same client libraries, same data files. For years you could swap one for the other and your app wouldn't notice.
Is that still true? Partly. For typical application SQL it mostly is. For replication, JSON, authentication, newer features and moving data files between them, the two have diverged a lot since MySQL 5.7 and MariaDB 10.x.
What's still compatible
- The wire protocol and client libraries. MySQL drivers (JDBC, PHP
mysqli/PDO, Python, Nodemysql2) connect to MariaDB, and MariaDB's connectors connect to MySQL. - Core SQL: DDL, DML, joins, subqueries, CTEs, window functions, stored procedures and triggers.
- InnoDB as the default storage engine, and
mysqldump/mariadb-dumplogical backups for ordinary schemas. - Tools: most GUI clients, ORMs and frameworks treat MariaDB as "MySQL" and work fine.
Where they've diverged
Replication and GTIDs. MySQL and MariaDB implement global transaction IDs differently, and their formats are incompatible. Replicating from MySQL 8 to MariaDB (or back) is limited and version-dependent. Don't plan a migration around live cross-replication without testing the exact versions.
JSON. MySQL stores JSON in a binary format with its own functions and indexing (multi-valued indexes). In MariaDB, JSON is an alias for LONGTEXT with a JSON_VALID check. Most JSON_* functions exist in both, but behavior, performance and some functions differ (for example ->> support and JSON_TABLE details).
Authentication. MySQL 8 defaults to the caching_sha2_password plugin. MariaDB servers use their own plugin set (mysql_native_password, ed25519, unix_socket, PAM, and newer options that vary by version). Clients compiled for one sometimes can't authenticate to the other without changing the user's plugin or the driver.
Collations and character sets. MySQL 8's default utf8mb4_0900_ai_ci collation isn't known to older MariaDB versions, so importing a MySQL 8 dump into MariaDB can fail with "Unknown collation". Rewrite collations in the dump, or target a MariaDB version that maps them.
Physical files and upgrades. MySQL 8 moved to a transactional data dictionary. You can't point MariaDB at a MySQL 8 data directory, or the reverse. Migrating between them means a logical dump and load (or a replication-based tool), not an in-place upgrade.
Features one has and the other doesn't.
| Only (or mainly) in MariaDB | Only (or mainly) in MySQL |
|---|---|
Sequences (CREATE SEQUENCE) | Binary JSON with multi-valued indexes |
| System-versioned (temporal) tables | InnoDB Cluster / Group Replication, MySQL Shell |
Oracle compatibility mode (sql_mode=ORACLE) | Document Store / X DevAPI |
| Thread pool in the community server | HeatWave (managed analytics and ML) |
| Storage engines such as ColumnStore, Spider, MyRocks | Invisible columns and other 8.x-specific syntax |
Optimizer and defaults. The query optimizers have evolved separately. The same query can get a different plan, and some system variables have the same name but different defaults or meanings.
So can you switch?
MySQL 5.7 app → MariaDB: usually smooth for application SQL. Test JSON usage, authentication and anything version-specific.
MySQL 8.x → MariaDB, or MariaDB → MySQL 8.x: treat it as a real migration:
- Take a logical dump, and rewrite collations and definers where needed.
- Load it into the target version in staging.
- Run the application test suite, and compare query plans for your top queries.
- Check JSON queries, stored programs and user accounts or authentication plugins.
- Cut over with a dump/restore or a CDC/replication tool you've tested with these exact versions.
Framework and ORM settings: tell your ORM which one you're using (for example Django's MariaDB backend, or Prisma's and Hibernate's MariaDB dialects) instead of pretending it's MySQL.
Checklist
- Protocol, drivers and core SQL are still compatible, so most apps connect fine.
- GTIDs, JSON storage, authentication plugins, collations and data files have diverged.
- You can't swap data directories. Migrate with dump/load or tested replication.
- Treat moves involving MySQL 8+ as real migrations and test them.
Get the weekly commit
New database deep dives every week.
