MySQL and MariaDB
Related providers with explicit engine, collation and DDL transaction differences.
Examples use Classic and Fluent tabs. Your choice follows you through the manual.
Choose the matching dialect
Select ProviderTypes.Mysql for MySQL and MariaDB for MariaDB. Use an open driver connection or configure the factory. Do not treat compatible wire protocols as proof of identical server syntax or metadata behavior. DDL can commit implicitly; the runner rejects WholeSession for these dialects.
Select a supported collation
Semantic presets require utf8mb4-compatible text and the documented server versions: MySQL 8 and MariaDB 10.10+ have different mappings. Use a named installed collation if exact linguistic or trailing-space behavior matters.
Classic
Database.AddTable("Labels", new Column("Name", DbType.String, 100)
{
Collation = Collation.CaseInsensitive
});Fluent
migration.Create.Table("Labels").WithColumn("Name").AsString(100)
.WithCollation(Collation.CaseInsensitive);Inside Up() / BuildUp(MigrationBuilder migration)
Constraint metadata
MySQL reports primary keys as PRIMARY even if the migration supplied a symbolic name. MySQL/MariaDB catalogs expose unique indexes as unique constraints, so metadata cannot recover every original CREATE UNIQUE INDEX versus UNIQUE-clause choice. Do not derive ownership from that distinction.
Locking and values
DatabaseMigrationLock uses named session locks. These coordinate one server, not a distributed cluster. Interval values use signed .NET ticks. String overflow behavior depends on SQL mode; boundary CI uses STRICT_ALL_TABLES. Check server settings when evaluating length and decimal errors.