> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL Storage

> MySQL-backed storage driver for sessions, memory, and culture

## Setup

```bash theme={null}
npm install mysql2
```

```typescript theme={null}
import { MySQLStorage } from "@agentium/core";

const storage = new MySQLStorage({
  host: "localhost",
  port: 3306,
  user: "root",
  password: "password",
  database: "agentium",
});

// Or use a connection string
const storage = new MySQLStorage({
  connectionString: "mysql://root:password@localhost:3306/agentium",
});
```

## Configuration

| Option             | Type     | Default       | Description            |
| ------------------ | -------- | ------------- | ---------------------- |
| `host`             | `string` | `"localhost"` | MySQL host             |
| `port`             | `number` | `3306`        | MySQL port             |
| `user`             | `string` | `"root"`      | Username               |
| `password`         | `string` | `""`          | Password               |
| `database`         | `string` | `"agentium"`  | Database name          |
| `connectionString` | `string` | —             | Full connection string |
| `tableName`        | `string` | `"kv_store"`  | Table name             |

The table is auto-created on first use with schema: `(namespace VARCHAR(255), key VARCHAR(255), value JSON, PRIMARY KEY(namespace, key))`.
