---
title: MySQL
description: Configure DurableStack with MySQL for durable shared-state execution.
order: 56
available_in: [dotnet, nodejs]
---

# 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

:::code-group
```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}";
});
```

```typescript
import { createDurableStackMySql } from "durablestack";

const { runtime } = await createDurableStackMySql(
  { connectionString: process.env.MYSQL_URL! },
  {
    workerName: `orders-api-${process.pid}`
  }
);
```
:::

## 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.
