ObjectStackObjectStack

Driver Mysql

Driver Mysql protocol schemas

MySQL / MariaDB driver configuration — the config slot of a datasource whose driver resolves to mysql (mysql2).

The driver id was offered by the connection form and buildable by the shared factory long before #4410, but had no config shape at all in packages/spec — postgres, mongo and memory each had one and mysql did not, so its config was the one slot with neither a gate nor a documented shape.

Every key here is read by createDefaultDatasourceDriverFactory (→ SqlDriver, knex mysql2). Postgres-only knobs are deliberately absent: mysql2 has no application_name and no statement_timeout, so declaring them would advertise settings the client drops.

Source: packages/spec/src/data/driver/mysql.zod.ts

TypeScript Usage

import { MysqlConfigSchema } from '@objectstack/spec/data';
import type { MysqlConfig } from '@objectstack/spec/data';

// Validate data
const result = MysqlConfigSchema.parse(data);

MysqlConfig

MySQL / MariaDB connection configuration

Properties

PropertyTypeRequiredDescription
urlstringoptionalConnection URI (supersedes the discrete fields; must not embed a password — bind the secret instead)
hoststringoptional (default: "localhost")Host address
portintegeroptional (default: 3306)Port number
databasestringoptionalDatabase name
usernamestringoptionalAuthentication user
passwordneveroptionalSet through the connection form's secret field or external.credentialsRef — encrypted into sys_secret, never stored in config (#7990)
sslbooleanoptionalEnable TLS. Certificates go in the datasource-level ssl block.
autoMigrateEnum<'off' | 'safe'>optionalDev-only non-destructive schema self-heal (#2186)

On this page