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

# PlanetScale

> Connect PlanetScale for read-only querying during investigations.

Connect PlanetScale so Struct Agent can query application data during investigations. Use the documented read access and verify the selected database and connection type.

## Inspect access and existing connections

Use a claimed workspace with permission to configure connections.

```bash theme={null}
struct whoami --json
struct connections catalog planetscale --json
struct connections list --json
```

Use the catalog's current fields, choices and permission requirements. Reuse an existing healthy connection instead of creating a duplicate.

## Connect with the CLI

Supply credentials from approved secret storage through `PLANETSCALE_PASSWORD`. The catalog describes which are needed for the selected authentication method. Do not put literal secrets in shell arguments or chat.

Replace example values with the intended resource:

```bash theme={null}
struct connect planetscale --engine postgres --host <host> --database <database> --user <username>
```

Create a read-only password for the selected branch and supply it through `PLANETSCALE_PASSWORD`. The engine defaults to Postgres (port 6432); use `--engine vitess` for MySQL (port 3306). SSH tunnels support the Postgres engine only. Use `--test-only` and inspect `ok` before saving when testing credentials.

## Verify and recover

Use the returned connection ID:

```bash theme={null}
struct connections show CONNECTION_ID --json
struct connections test CONNECTION_ID --json
```

Inspect `ok`, `health` and missing permissions, not only the exit code. `struct connections grant-command CONNECTION_ID` prints repair instructions where supported; have an authorized operator apply them. For expired OAuth links, start the connection command again and use the new link. Do not reconnect to a different account silently.

Verify a bounded operation for the requested job. Connection health proves checked access; it does not prove telemetry arrival, an investigation or alert delivery.

## What Struct does with it

Answers data questions during investigations and measures the impact of [Issues](https://docs.struct.ai/agent/jobs/issues.md) with live queries you can inspect.

## Permissions

Create a read-only credential (Postgres: a role inheriting pg\_read\_all\_data; Vitess: a password with the reader role) and provide its host, database, username and password.

### Read-only queries

Answer data questions during investigations and measure the impact of open issues.

| Role | Used for |
| - | - |
| `reader` | Vitess (MySQL) password role |
| `pg_read_all_data` | Postgres engine: the role Struct's role inherits |

* On the Postgres engine, `pg_read_all_data` reads every table in every database on the branch. To limit Struct to the schemas you choose, create the role without it and grant USAGE and SELECT on those schemas, as in the PostgreSQL setup.

### How to grant

> [accordion] Vitess (MySQL): create a read-only password
>
> ```bash theme={null}
> pscale password create <database> main struct-reader --role reader
> ```

> [accordion] Postgres: create a read-only role
>
> ```bash theme={null}
> pscale role create <database> main struct-reader --inherited-roles pg_read_all_data
> ```

Replace the values in angle brackets.

Permission catalog version `2026-11-04.1`. See [permission changes](https://docs.struct.ai/reference/permission-changes.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.