Skip to main content
The PlanetScale integration is in preview. To enable it for your workspace, email support@unkey.com.
Connect a PlanetScale database to your and Unkey handles the credentials for you. You never copy a password into an environment variable: each deployment gets its own credential when it starts, and Unkey deletes it after the deployment stops. Unkey supports PlanetScale Postgres, Vitess (MySQL), and Neki.

How it works

Below is an example of an app with a PlanetScale database named orders, which has a main branch and a preview branch:
  1. Connect your PlanetScale account to your Unkey workspace once, with OAuth. See Connect and disconnect.
  2. Add the orders database to your project. It can be an existing database or one you create from the dashboard.
  3. Connect each of your app to one branch. Here, production reads and writes main, and preview reads and writes preview. You also pick the variable name your app reads the database URL from, such as ORDERS_URL. See Production and preview for how environments and deployments relate.
  4. Every new deployment gets its own username and password on its environment’s branch. Unkey puts the connection URL in ORDERS_URL, plus ORDERS_UNPOOLED_URL on Postgres. Production and preview use the same names, but each points at its own branch. See Environment variables. Deployments from fork pull requests get no credentials.

Limits

Next steps

Connect and disconnect

Connect your PlanetScale account and databases, and disconnect them later.

Environment variables

The URLs your app reads, and the read-only replica URL.

Migrations

Run schema changes with a PlanetScale credential.

Credentials and security

What each credential can do, when it is deleted, and how Unkey stores secrets.

Troubleshooting

Fix a disconnected account and failed deployments.
Last modified on December 1, 2026