MySQL Support
SQL Build Manager supports MySQL as a first-class database target alongside Microsoft SQL Server and PostgreSQL.
Select MySQL at runtime with --platform MySQL.
Quick Start
To run a build against a MySQL database, add --platform MySQL:
sbm build ^
--packagename "mypackage.sbm" ^
--server "mysql-server.mysql.database.azure.com" ^
--database "mydb" ^
--username "myuser" ^
--password "mypassword" ^
--platform MySQL
For threaded execution across multiple MySQL databases:
sbm threaded run ^
--packagename "mypackage.sbm" ^
--override "mysql-databasetargets.cfg" ^
--username "myuser" ^
--password "mypassword" ^
--platform MySQL
How It Works
When --platform MySQL is specified:
- Connections use MySqlConnector (
MySqlConnection). - Transactions use savepoint semantics compatible with MySQL execution.
- SQL syntax is adapted for MySQL execution and logging queries.
- Build logging uses a MySQL-native
sqlbuild_loggingtable (DATETIME(6),LONGTEXT,TINYINT(1),CHAR(36)). - Runtime wiring selects MySQL-specific implementations for:
IDbConnectionFactoryITransactionManagerIScriptSyntaxProviderISqlResourceProvider
Script Authoring Notes
When authoring scripts for MySQL targets, use MySQL-compatible syntax.
| SQL Server | MySQL |
|---|---|
GO batch separator |
Not required; terminate statements with ; |
[dbo].[TableName] |
`table_name` (or unquoted names) |
NVARCHAR(MAX) |
LONGTEXT |
DATETIME |
DATETIME(6) |
BIT |
TINYINT(1) |
UNIQUEIDENTIFIER |
CHAR(36) (or BINARY(16) if desired) |
GETDATE() |
NOW() / CURRENT_TIMESTAMP |
IDENTITY(1,1) |
AUTO_INCREMENT |
TOP(n) |
LIMIT n |
If your fleet includes multiple database engines, maintain separate
.sbmpackages with platform-appropriate SQL.
Supported Execution Models
MySQL is supported across local and remote execution models:
| Execution Model | Command | MySQL Support |
|---|---|---|
| Local build | sbm build |
✅ Supported |
| Threaded | sbm threaded run |
✅ Supported |
| Azure Batch | sbm batch run |
✅ Supported |
| Kubernetes | sbm k8s run |
✅ Supported |
| Container Apps | sbm containerapp run |
✅ Supported |
| ACI | sbm aci run |
✅ Supported |
Settings Files
--platform MySQL is preserved in saved settings files.
sbm batch savesettings ^
--settingsfile "mysql-settings.json" ^
--settingsfilekey "mykey" ^
--platform MySQL ^
--server "mysql-server.mysql.database.azure.com" ^
--username "myuser" ^
--password "mypassword"
For azd up environments, post-provision scripts can generate MySQL settings in src/TestConfig, including password-based variants such as:
settingsfile-aci-mysql-password.jsonsettingsfile-batch-linux-mysql-password.jsonsettingsfile-containerapp-mysql-password.jsonsettingsfile-k8s-mysql-password.json
Authentication
Username/Password
--authtype Password --username "myuser" --password "mypassword"
This is the default MySQL mode for generated external-test settings (MYSQL_AUTH_MODE=Password).
Managed Identity (Azure MySQL)
Managed Identity mode is supported for Azure Database for MySQL when environment permissions are configured for Entra-based MySQL user creation.
--authtype ManagedIdentity --identityclientid "<managed-identity-client-id>"
For azd up deployments, enable this path with:
azd env set MYSQL_AUTH_MODE ManagedIdentity
Features Not Yet Available for MySQL
The following remain SQL Server-only:
- DACPAC operations (
create fromdacpacs,create fromdacpacdiff,--platinumdacpac,--targetdacpac,--forcecustomdacpac) - SMO-based object scripting
- Windows integrated authentication (
--authtype Windows) - SQL Server-specific script policies (for example,
WithNoLockPolicy,QualifiedNamesPolicy, T-SQL syntax checks)