Navigation

MySQL compatibility

Overview

PlanetScale is built on top of open-source Vitess, a database clustering system for horizontal scaling of MySQL. Consequently, PlanetScale is only compatible with MySQL databases.

PlanetScale databases run on MySQL 8. If you're importing an existing database, PlanetScale supports MySQL database versions 5.7 through 8.0.

New PlanetScale databases are created on MySQL 8 with character set utf8mb4_0900_ai_ci. PlanetScale supports utf8, utf8mb4, and utf8mb3, character sets. We also support latin1 and ascii character sets, but do not recommend them.

MySQL compatibility limitations

The following reference guide will cover some MySQL syntax, features, and more that PlanetScale either does not support or has limitations around. We are actively working on driving up compatibility, but it's an ongoing effort and will take some time to complete. See this project board on GitHub to learn what the Vitess team is currently focusing on.

If you're attempting to import a database using our Import tool, there are some additional requirements that you can find in our Database imports documentation.

Queries, functions, syntax, data types, and SQL modes

Note

❗ = Limitations in support

❌ = Not supported

StatementSupportDescription
ALTER TABLE...RENAME COLUMNRenaming columns and tables may be destructive. See our guide for column rename recommendations.
CREATE DATABASEYou cannot CREATE a PlanetScale database from the MySQL command line, however, this is supported in the PlanetScale CLI.
DROP DATABASEYou cannot DROP a PlanetScale database from the MYSQL command line, however, this is supported in the PlanetScale CLI.
JSON_TABLEThe JSON_TABLE function is not yet supported. All other JSON SQL functions should work.
PROCEDUREWe do not support any form of stored routines.
FUNCTIONWe do not support any form of stored routines.
TRIGGERWe do not support any form of stored routines.
EVENTWe do not support any form of stored routines.
LOAD DATA INFILELoading data via LOAD DATA INFILE is not supported.
KILLWe do not support killing queries or shards from the command line.
:=The := assignment operator is not yet supported.
SET GLOBAL time_zoneThe global time zone is set to UTC and can not be modified.
SET GLOBAL sql_modeThe global SQL mode can not be changed permanently. Set each new session's mode instead with SET sql_mode.
PIPES_AS_CONCATEnabling this SQL mode can interfere with Vitess' evalengine parsing the SQL queries so enabling it may result in incorrect or unexpected results. Please use MySQL's standard dialect instead, e.g. CONCAT().
ANSI_QUOTESEnabling this SQL mode can interfere with Vitess' evalengine parsing the SQL queries so enabling it may result in incorrect or unexpected results. Please use MySQL's standard quotation instead.
INSERT ... AS ...In an INSERT ... AS ... statement, aliasing the columns or rows is not yet supported.
WITH RECURSIVEWe do not support recursive common table expressions (CTEs)

Miscellaneous

ActionSupportDescription
Empty schemasDatabases with empty schemas are invalid. You cannot deploy a schema change to production if no tables exist.
Non-InnoDB Storage engineWe only support InnoDB storage engine.
No applicable unique keyWe require all tables have a unique, non-null key and that respective covered columns are shared between old and new schema.
Direct DDLWe do not allow Direct DDL on production branches when safe migrations is enabled. This includes TRUNCATE statements.
Binary log accessPlanetScale does not currently support binlog replication to external databases.
Large JSON documentsMySQL supports JSON documents up to 1 GB in size. However, we do not recommend to store more than a few MB in a JSON document for performance reasons.

FAQ

Postgres support

PlanetScale does not support PostgreSQL. We have worked with customers to migrate their Postgres databases to MySQL/PlanetScale. If you have questions about migrating, get in touch.

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.