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

# PlanetScale Postgres

> Connect PlanetScale Postgres to Midplane: a read-only role from PlanetScale's dashboard, the direct port, IP restrictions, and verified TLS. PlanetScale's MySQL (Vitess) isn't supported.

PlanetScale's MySQL databases (Vitess) aren't supported: ask for them with
**Request a source**. PlanetScale Postgres connects, with one trap: it
routes each login to a branch by its user name (`<role>.<branch id>`), and
Midplane's switch logs in as the role's name alone. So use a read-only
role from PlanetScale's dashboard instead of the role script.

**1. Make a read-only role**

On the branch you want, create a role with `pg_read_all_data` as its
only permission, and copy its credentials
([PlanetScale's roles](https://planetscale.com/docs/postgres/connecting/roles)).

**2. Write the connection string**

Use the direct port, 5432, and the user as PlanetScale gives it:

```text theme={null}
postgres://<role>.<branch id>:<password>@<host>:5432/postgres?sslmode=verify-full
```

To read a replica, add `|replica` to the user. `sslrootcert` shows as
**Ignored**, which is fine.

**3. Let Midplane in, if IP restrictions are on**

Under **Settings**, **IP restrictions**, add both of your region's
[egress addresses](https://midplane.ai/docs/connect/allowlist.md)
([PlanetScale's IP restrictions](https://planetscale.com/docs/postgres/connecting/ip-restrictions)).

PlanetScale's certificates come from a public authority: **TLS verified**,
and the role shows **Reads only**.

> [accordion] If you connected with the default postgres role
>
> Don't run the role script: it makes a role Midplane can't switch to.
> Paste the read-only role's string under **Credentials** and select
> **Test and replace**.


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