Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,150 of 9,150 pages
About the help in other languages
All help pages

Databases that speak the MySQL protocol

This page is for administrators who want to run Exponential on a database that speaks the MySQL protocol but is not MySQL or MariaDB, and for developers who work on its drivers: TiDB, Vitess and PlanetScale…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/features/6.0/mysql-wire-databases.md

On this page

Databases that speak the MySQL protocol

This page is for administrators who want to run Exponential on a database that speaks the MySQL protocol but is not MySQL or MariaDB, and for developers who work on its drivers: TiDB, Vitess and PlanetScale, SingleStore, MariaDB Xpand and Amazon Aurora MySQL. From Exponential 6.0.15 the kernel has a driver for each of them. Every one is the MySQL driver eZMySQLiDB with a profile of what its database does differently.

Status. TiDB, Vitess and SingleStore install and run a whole site (measured below). Xpand and Aurora MySQL have their drivers and profiles, written from their vendors' documentation; they could not run here (Xpand has no public container image, Aurora runs only at AWS), so they are not measured. The tables per database say what works and what does not.

Contents

  1. The drivers
  2. What works and what does not
  3. Settings
  4. What the drivers do differently
  5. Installing a site
  6. Data table connections
  7. Clustering
  8. Tests

The drivers

DatabaseDatabaseImplementationDriver classLevel reachedMeasured on
TiDBtidbexpTiDBDBfull site databaseTiDB 8.5.1 (pingcap/tidb:v8.5.1)
Vitess, PlanetScalevitess, planetscaleexpVitessDBfull site database (an unsharded keyspace)Vitess 25 vttestserver (MySQL 8.4 underneath)
SingleStoresinglestore, memsqlexpSingleStoreDBfull site databaseSingleStore 10.10 (singlestoredb-dev, no license key)
MariaDB XpandxpandexpXpandDBprofile, not measurednone: no public container image
Amazon Aurora MySQLaurora, auroramysqlexpAuroraMySQLDBprofile, not measurednone: a managed service only

"Full site database" means what it means for the SQL Server driver: exp:install installs the site package with its content, the site runs on it, and data table connections and imports reach it.

All drivers need PHP's mysqli. databaseName() is mysql for every one: the kernel's MySQL statements, the MySQL schema handler (eZMysqlSchema), the MySQL DFS cluster backend and the portable SQL helpers (sqlHelperDialect() mysql) work as they are, and the driver sends each statement the way its database takes it. The profiles are in expMySQLWireProfile (lib/ezdb/classes/expmysqlwireprofile.php), a class of pure functions.

What works and what does not

TiDB

TiDB 6.5 and later, self-hosted or TiDB Cloud (with SSL=verify). Measured on TiDB 8.5.1.

WorksDoes not, or differently
a whole site: exp:install --db=tidb, the kickstarter (Type=tidb), the setup wizardBEGIN WORK is refused: the driver sends BEGIN
foreign keys, enforced (TiDB 8.5)LOCK IN SHARE MODE and FOR SHARE are refused: the driver sends FOR UPDATE, which locks more, never less
transactions, savepointsisolation levels READ UNCOMMITTED and SERIALIZABLE are refused; READ COMMITTED and REPEATABLE READ (snapshot) work
AUTO_INCREMENT in MySQL's order: new tables get AUTO_ID_CACHE=1without it, ids are unique but cached per TiDB server: not in insert order across servers
GET_LOCK(); table locks become named locksLOCK TABLES does nothing unless the server runs with enable-table-lock
case-insensitive text: new tables get COLLATE=utf8mb4_general_ciTiDB's default collation is utf8mb4_bin (case sensitive); clusters created with new_collations_enabled_on_first_bootstrap=false treat every collation as binary
FULLTEXT is acceptedno full-text index is built; the audit log console searches with LIKE
ALTER TABLE with several changes, MODIFY, CHANGE, RENAME TABLEOPTIMIZE TABLE is refused: the driver sends ANALYZE TABLE
upsert, GROUP_CONCAT, timestamps past 2038, utf8mb4XA transactions, CHECKSUM TABLE, SQL_CALC_FOUND_ROWS (the kernel uses none of them on a site)
the MySQL DFS cluster backenddropping the primary key of a table with a clustered index

Vitess and PlanetScale

Vitess with one unsharded keyspace, and PlanetScale's MySQL databases (which are Vitess). Measured on a Vitess 25 vttestserver with --foreign_key_mode=disallow, as PlanetScale runs by default.

WorksDoes not, or differently
a whole site in an unsharded keyspace: exp:install --db=vitessthe keyspace is not made by CREATE DATABASE: create it in Vitess (vtctldclient) or in PlanetScale's console first; --db-action=remove drops its tables, never the keyspace
everything MySQL 8 does: MySQL runs underneathforeign keys are refused with foreign_key_mode=disallow: the driver leaves them out of CREATE TABLE and ALTER TABLE (the kernel schema has none)
transactions, savepoints, every isolation level, LOCK TABLES, GET_LOCK()a transaction longer than the tablet's transaction timeout is killed (vttablet's default 30 seconds, PlanetScale 20 seconds). The site package installs in one long transaction: raise --queryserver-config-transaction-timeout (600s here) for the install; on PlanetScale install elsewhere and import
AUTO_INCREMENT as MySQL in an unsharded keyspacea sharded keyspace needs a vindex and a sequence table per table: not supported for a site; a data table connection can use a sharded table that is set up so
FULLTEXT, upsert, GROUP_CONCAT, timestamps past 2038BEGIN WORK, XA and CHECKSUM TABLE are refused: the driver sends BEGIN for the first
TLS (SSL=verify), which PlanetScale requiresPlanetScale's deploy requests change the schema of production branches: install on a development branch

SingleStore

SingleStore 8.5 and later, self-hosted or SingleStore Helios (with SSL=verify). Measured on SingleStore 10.10, the free singlestoredb-dev container.

WorksDoes not, or differently
a whole site: exp:install --db=singlestorea unique key must hold the shard key: the driver creates every table with a primary key as a reference table (CREATE ROWSTORE REFERENCE TABLE), copied to every leaf, and a table without one as a rowstore table. Right for a CMS; a very large table would rather be sharded by hand
AUTO_INCREMENT in insert order (reference tables, generated on the master aggregator)foreign keys are refused: left out
transactionsisolation is READ COMMITTED whatever is set; SAVEPOINT is accepted and does nothing (a rollback to it rolls back nothing)
upsert, GROUP_CONCAT, utf8mb4FULLTEXT on rowstore tables is refused: left out, the audit log console searches with LIKE
timestamps past 2038: sqlUnixTimestamp() and sqlFromUnixTimestamp() count with TIMESTAMPDIFF and TIMESTAMPADDSingleStore's own UNIX_TIMESTAMP() and FROM_UNIXTIME() end in 2038
case-insensitive text: new tables get COLLATE=utf8mb4_general_cithe default collation is utf8mb4_bin
LOCK TABLES is acceptedGET_LOCK() does not exist; RENAME TABLE (the driver sends ALTER TABLE ... RENAME TO), ALTER TABLE ... CHANGE of a column's type (use MODIFY), DELETE ... ORDER BY ... LIMIT, SHOW CREATE DATABASE (the driver reads information_schema), CHECKSUM TABLE, XA
prefix indexes are acceptedthe prefix length is ignored: the whole column is indexed

MariaDB Xpand

Not measured: MariaDB does not publish a container image of Xpand, and it is sold only as part of SkySQL and Enterprise subscriptions. The profile follows Xpand 6's documentation.

Expected to workDoes not, or differently (documented)
a whole site: exp:install --db=xpand (unverified)FULLTEXT indexes are not supported: left out
foreign keys, transactions, savepoints, READ COMMITTED, REPEATABLE READ, SERIALIZABLEAUTO_INCREMENT values are unique but not in insert order (allocated per node)
GET_LOCK(): table locks become named locksLOCK TABLES is accepted and ignored; XA

Amazon Aurora MySQL

Not measured: Aurora runs only at AWS, and nothing was signed up for. Aurora MySQL 3 is MySQL 8.0, so the driver is the MySQL driver with one addition.

Expected to workDoes not, or differently (documented)
everything MySQL 8.0 does: exp:install --db=aurora (unverified)after a failover the cluster endpoint can still lead to the old writer, now a reader, for some seconds: every write fails with 1290 or 1836. The driver checks @@innodb_read_only when it connects and connects again (FailoverRetries, FailoverWait)
the reader endpoint as the read replica (UseSlaveServer, SlaveServerArray)the replica lag check reads MySQL's replica status, which Aurora's readers do not show: set SlaveServerStatusCheck=disabled
TLS (SSL=verify with Amazon's CA bundle as SSLCA)IAM authentication tokens are not supported: use a database user and password

Settings

[DatabaseSettings] as for MySQL (Server, Port, User, Password, Database, Socket), with the driver's DatabaseImplementation, and [MySQLWireSettings] in site.ini:

[DatabaseSettings]
DatabaseImplementation=tidb
Server=tidb.example.com
Port=4000
User=exponential
Password=...
Database=site

[MySQLWireSettings]
# empty: the driver's own profile; tidb, vitess, singlestore, xpand, aurora, mysql or mariadb
Profile=
# warning: each connection asks the server what it is and warns when it is not the profile's database
VerifyServer=disabled
# READ COMMITTED, REPEATABLE READ ... as the database keeps it; empty: the server's default
IsolationLevel=
# auto (the profile's), native (LOCK TABLES), named (GET_LOCK), none
TableLocks=auto
NamedLockTimeout=30
# TiDB: AUTO_ID_CACHE of new tables; 1 hands out ids in MySQL's order, 0 leaves TiDB's cache
TiDBAutoIdCache=1
# disabled, enabled (TLS, the certificate is not checked) or verify (checked against SSLCA, else the system's CAs)
SSL=disabled
SSLCA=
SSLCert=
SSLKey=
# Aurora: a primary that is read-only after connecting is connected to again
FailoverCheck=auto
FailoverRetries=5
FailoverWait=1

The installer writes SSL and SSLCA into settings/override/site.ini.append.php as well as into each siteaccess, because the cluster file handler connects before a siteaccess is matched.

What the drivers do differently

expMySQLWireDB::query() passes every statement through expMySQLWireProfile::rewriteStatement(), which returns the statements to send: one in most cases, none when the database has no use for it, two for a RENAME TABLE of two tables on SingleStore. Data statements (INSERT, UPDATE, DELETE, a SELECT without SHARE) are not even looked at past their first word. The rules, all tested without a server:

StatementTiDBVitessSingleStoreXpandAurora
BEGIN WORKBEGINBEGINBEGINBEGINBEGIN
CREATE TABLECOLLATE=utf8mb4_general_ci, AUTO_ID_CACHE=1foreign keys left outROWSTORE REFERENCE (with a primary key), foreign keys and FULLTEXT left out, COLLATE=utf8mb4_general_ciFULLTEXT left outas it is
ALTER TABLE ... ADD FOREIGN KEYas it isnot sentnot sentas it isas it is
ALTER TABLE ... ADD FULLTEXT, CREATE FULLTEXT INDEXas it isas it isnot sentnot sentas it is
SELECT ... LOCK IN SHARE MODE / FOR SHAREFOR UPDATEas it isLOCK IN SHARE MODEas it isas it is
RENAME TABLE a TO b, c TO das it isas it isone ALTER TABLE ... RENAME TO eachas it isas it is
OPTIMIZE TABLEANALYZE TABLEas it isas it isas it isas it is

A collation is added only when the statement names none and its character set is utf8mb4 or utf8 (or none: the database's). CREATE TABLE ... LIKE and temporary tables are not changed. The parser respects quotes and parentheses: a default value 'FOREIGN KEY, (x)' stays as it is.

Besides the statements:

  • Table locks (lock(), used for the language mask, order statuses, the search log, identifiers): named takes one GET_LOCK('exp:<database>.<table>') per table, sorted, so two sessions cannot wait for each other, and unlock() releases them in reverse order.
  • Databases: createDatabase() makes a TiDB database utf8mb4_general_ci. On Vitess it makes nothing: it checks that the keyspace exists, and removeDatabase() drops the keyspace's tables and views. The servers' own databases (cluster, memsql, METRICS_SCHEMA, _vt ...) are not listed.
  • Relations: foreign keys are offered as a relation type only where they are kept (TiDB, Xpand, Aurora).
  • TLS: SSL=enabled or verify opens the connection with mysqli_ssl_set() and MYSQLI_CLIENT_SSL.

Installing a site

Create the database first, as for MySQL (on Vitess and PlanetScale the keyspace or database in their own tools; on TiDB CREATE DATABASE site CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci). Then, with mysqli in the PHP of the command line:

EXP_INSTALL_DB_PASSWORD=secret ./console exp:install --apply --db=tidb --db-host=tidb.example.com \
  --db-port=4000 --db-name=site --db-user=exponential
EXP_INSTALL_DB_PASSWORD=secret ./console exp:install --apply --db=planetscale --db-host=aws.connect.psdb.cloud \
  --db-port=3306 --db-name=site --db-user=... --db-ssl=verify
EXP_INSTALL_DB_PASSWORD=secret ./console exp:install --apply --db=singlestore --db-host=svc.singlestore.com \
  --db-port=3306 --db-name=site --db-user=admin --db-ssl=verify

--db= takes tidb, vitess (or planetscale), singlestore (or memsql), xpand and aurora (or aurora-mysql); --db-ssl takes enabled or verify, --db-ssl-ca a CA file. The kickstarter takes the same names as [database_choice] Type, and SSL and SSLCA in [database_init]. The setup wizard in the browser lists TiDB, Vitess / PlanetScale, SingleStore, MariaDB Xpand and Amazon Aurora MySQL after MySQL when PHP has mysqli (TiDB with port 4000 prefilled); TLS (SSL, SSLCA) is set through the kickstarter or exp:install.

Measured on 2026-11-26, the site package sevenx_multisite with its demo content, PHP 8.5, each database in a container with two to four cores, on a host busy with other work (the times compare poorly). After each install the front page and the administration's login page answered 200 over PHP's built-in server, exp:cluster:enable --apply made a one-node DFS cluster (312 files, the metadata in the same database) and the front page answered 200 again:

DatabaseResultStepsErrorsChecksPackage objectsTime
TiDB 8.5.1installed1609 passed291764 s
Vitess 25 (vttestserver, transaction timeout 600 s)installed1609 passed291526 s
SingleStore 10.10installed1609 passed291279 s

With vttablet's default transaction timeout of 30 seconds the Vitess install stopped in the demo content package ("transaction ... in use: for tx killer rollback"). The migrations that run after an install take no exact database marker on these three (they refuse CHECKSUM TABLE), and go on without one, as on a database without a caption.

Data table connections

A data table connection names one of these databases as its engine (tidb, vitess, planetscale, singlestore, xpand, aurora), or the engine mysql with the option profile. It is opened by the database's driver, so the same rules apply; the options ssl and ssl_ca set TLS:

[Connection_analytics]
Engine=singlestore
Server=svc.singlestore.com
Port=3306
Database=analytics
User=reader
Secret=env:ANALYTICS_PASSWORD
Options[ssl]=verify

Without mysqli the connection falls back to PDO MySQL as a plain MySQL connection, without the profile.

Clustering

exp:cluster:enable takes the MySQL DFS backend (eZDFSFileHandlerMySQLiBackend) for all of these: its schema goes through the driver (kernel/sql/mysql/cluster_dfs_schema.sql, rewritten as above), and the backend's own statements (BEGIN, SELECT ... FOR UPDATE) are taken by every one of them. Measured on TiDB, Vitess and SingleStore (above). The backend opens its own mysqli connection, without TLS: on PlanetScale, TiDB Cloud and SingleStore Helios, which require TLS, keep the DFS metadata in another database.

Tests

tests/tests/lib/ezdb/mysqlwire/ (DB-less, testsuite mysqlwire) and .../mysqlwire/live/ (testsuite mysqlwire-live; each database skips without EXP_TEST_<TIDB|VITESS|SINGLESTORE|XPAND|AURORA>_HOST, and _PORT, _USER, _PASSWORD or _PASSWORD_FILE, _DATABASE). The GitHub job mysqlwire runs the live tests against TiDB 8.5.1, Vitess (vttestserver) and SingleStore (singlestoredb-dev) in containers; Xpand and Aurora skip.

FileWhat
expMySQLWireProfileTestthe facts of every profile, recognising a server, every rewrite rule, the kernel and cluster schemas rewritten for each database
expMySQLWireDBTestthe driver over a recording connection: settings, statements in order, BEGIN, named and native table locks, relations, timestamps, databases and keyspaces, the character set, isolation levels, Aurora's failover check, the installer, the setup wizard, the cluster setup and data table connections
live/expMySQLWireLiveTestagainst each server: it is recognised, MySQL's DDL with foreign keys, FULLTEXT and prefix indexes, case-insensitive text and emoji, ids after an explicit id, transactions, shared locks and table locks, upsert, GROUP_CONCAT, timestamps past 2038, schema changes and the schema read back

The feature probe behind the tables above ran the same statements against each container, outside the test suite.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x