---
title: MySQL
description: Configure DurableStack with MySQL for durable shared-state execution.
order: 56
---

# MySQL

MySQL is a durable provider option for teams already operating MySQL in production.

It supports shared worker coordination through DurableStack's standard run/lease contract.

## Registration

```csharp
using DurableStack.Hosting.DependencyInjection;

var connectionString = "Server=localhost;Port=3306;Database=durable_stack;User ID=root;Password=postgres;SslMode=Preferred";

builder.Services.AddDurableStackMySql(connectionString, options =>
{
    options.WorkerName = $"orders-api-{Environment.MachineName}-{Environment.ProcessId}";
});
```

## Operational notes

- Validate throughput and lock behavior with expected worker count.
- Prefer secure transport and least-privilege database credentials.
- Keep retention settings aligned with storage cost and debugging needs.
