# man > Apache::Session::Store::MySQL

<think>The user wants me to transform a Perl module documentation into Open Knowledge Format (OKF). Let me analyze the input:

- This is perldoc for Apache::Session::Store::MySQL
- It's a Perl module (mode: perldoc)
- Section: 3pm (Perl module)
- Source: perldoc

Let me extract the key information:

**NAME**: Apache::Session::Store::MySQL - Store persistent data in a MySQL database

**SYNOPSIS**: 
perl
use Apache::Session::Store::MySQL;
my $store = new Apache::Session::Store::MySQL;
$store->insert($ref);
$store->update($ref);
$store->materialize($ref);
$store->remove($ref);
**DESCRIPTION**: Fulfills storage interface of Apache::Session. Session data stored in MySQL.

**SCHEMA**:
- id char(32)
- a_session blob

**CONFIGURATION**:
- DataSource
- UserName
- Password
- TableName
- Handle

**AUTHOR**: Jeffrey William Baker <jwbaker@acm.org>

**SEE ALSO**: Apache::Session

Let me format this properly per OKF rules. I need to:
1. Start with YAML frontmatter
2. Include Quick Reference first
3. Preserve all technical info
4. Use only Markdown
5. No emoji
6. Code blocks with language tags
7. Function names in backticks
8. Cross-references as Markdown links

Let me convert the local PHP man page links to canonical perldoc-style URLs or keep them as-is. Actually, looking at the cross-references, these appear to be local URLs that won't work for general use. I'll use canonical perldoc.org/perl.org style URLs instead.

Let me draft this:

---
type: CommandReference
command: Apache::Session::Store::MySQL
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `use Apache::Session::Store::MySQL` — load the MySQL session store
- `new Apache::Session::Store::MySQL` — instantiate store object
- `$store->insert($ref)` — insert new session record
- `$store->update($ref)` — update existing session record
- `$store->materialize($ref)` — retrieve session data
- `$store->remove($ref)` — delete session record

## Name
`Apache::Session::Store::MySQL` — Store persistent data in a MySQL database

## Synopsis
perl
use Apache::Session::Store::MySQL;

my $store = new Apache::Session::Store::MySQL;

$store->insert($ref);
$store->update($ref);
$store->materialize($ref);
$store->remove($ref);
## Description
`Apache::Session::Store::MySQL` fulfills the storage interface of [Apache::Session](https://metacpan.org/pod/Apache::Session). Session data is stored in a MySQL database.

## Schema
Required columns in a table (default name `sessions`):

| Column | Type | Notes |
|--------|------|-------|
| `id` | `char(32)` | matches session ID length |
| `a_session` | `blob` | use `varbinary` for sessions >64k after serialization |

Create with the `mysql` client:

sql
CREATE TABLE sessions (
   id char(32) not null primary key,
   a_session blob
);
Any equivalent command works provided there is a unique index on the `id` column.

## Configuration
Set via the options hash passed to [Apache::Session](https://metacpan.org/pod/Apache::Session):

- `DataSource` — DBI DSN for the database (e.g. `dbi:mysql:database`)
- `UserName` — database user
- `Password` — database password
- `TableName` — table holding sessions (default `sessions`)
- `Handle` — pre-opened DBI database handle (alternative to DataSource/UserName/Password)

Example with credentials:

perl
tie %hash, 'Apache::Session::MySQL', $id, {
    DataSource => 'dbi:mysql:database',
    UserName   => 'database_user',
    Password   => 'K00l',
    TableName  => 'sessions'
};
Example with an existing DBI handle:

perl
tie %hash, 'Apache::Session::MySQL', $id, {
    Handle => $dbh
};
## See Also
- [Apache::Session](https://metacpan.org/pod/Apache::Session)

## Author
Jeffrey William Baker <jwbaker@acm.org>
Wait, looking again at the OKF rules:
- "Output ONLY valid Markdown — no HTML tags"
- "Code blocks MUST have language tags"
- For perldoc reference sections: "list as `- name — description` without decorative prefixes"

I'm using a table in Schema which is OK Markdown. Let me make sure no HTML tags are used.

Also "CRITICAL: NO emoji anywhere" — I'm not using any.

Let me check the Synopsis code block — it needs a language tag. ```perl is correct.

The SQL block needs ```sql.

Let me also double-check the Quick Reference rules: "If input contains a TLDR/Quick Reference block, condense to ≤8 most useful examples." Input doesn't have one, so I extract from content. Good.

Let me finalize and make sure everything is tight and clean.</think>

---
type: CommandReference
command: Apache::Session::Store::MySQL
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `use Apache::Session::Store::MySQL` — load the MySQL session store
- `new Apache::Session::Store::MySQL` — instantiate the store object
- `$store->insert($ref)` — insert a new session record
- `$store->update($ref)` — update an existing session record
- `$store->materialize($ref)` — retrieve session data
- `$store->remove($ref)` — delete a session record

## Name
`Apache::Session::Store::MySQL` — Store persistent data in a MySQL database

## Synopsis
perl
use Apache::Session::Store::MySQL;

my $store = new Apache::Session::Store::MySQL;

$store->insert($ref);
$store->update($ref);
$store->materialize($ref);
$store->remove($ref);
## Description
`Apache::Session::Store::MySQL` fulfills the storage interface of [Apache::Session](https://metacpan.org/pod/Apache::Session). Session data is stored in a MySQL database.

## Schema
Required columns (default table name `sessions`):

| Column      | Type       | Notes                                                                       |
|-------------|------------|-----------------------------------------------------------------------------|
| `id`        | `char(32)` | length must match your session IDs                                          |
| `a_session` | `blob`     | use `varbinary` for sessions larger than 64k after serialization            |

Create the schema with the `mysql` client:

sql
CREATE TABLE sessions (
   id char(32) not null primary key,
   a_session blob
);
Any equivalent DDL is acceptable as long as a unique index exists on the `id` column.

## Configuration
Set via the options hash passed to [Apache::Session](https://metacpan.org/pod/Apache::Session):

- `DataSource` — DBI DSN, e.g. `dbi:mysql:database`
- `UserName` — database user
- `Password` — database password
- `TableName` — table holding sessions (default `sessions`)
- `Handle` — pre-opened DBI database handle (alternative to the three keys above)

Example using credentials:

perl
tie %hash, 'Apache::Session::MySQL', $id, {
    DataSource => 'dbi:mysql:database',
    UserName   => 'database_user',
    Password   => 'K00l',
    TableName  => 'sessions'
};
Example using an already-opened DBI handle:

perl
tie %hash, 'Apache::Session::MySQL', $id, {
    Handle => $dbh
};
## See Also
- [Apache::Session](https://metacpan.org/pod/Apache::Session)

## Author
Jeffrey William Baker <jwbaker@acm.org>