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
| Property | Type | Required | Description |
|---|---|---|---|
| url | string | optional | Connection URI (supersedes the discrete fields; must not embed a password — bind the secret instead) |
| host | string | ✅ | Host address |
| port | integer | ✅ | Port number |
| database | string | optional | Database name |
| username | string | optional | Authentication user |
| password | never | optional | Set through the connection form's secret field or external.credentialsRef — encrypted into sys_secret, never stored in config (#7990) |
| ssl | boolean | optional | Enable TLS. Certificates go in the datasource-level ssl block. |
| autoMigrate | Enum<'off' | 'safe'> | optional | Dev-only non-destructive schema self-heal (#2186) |