pscale CLI to do the following:
- Create, delete and list your databases and branches
- Run non-interactive SQL for agents and scripts (
pscale sql) - Open a secure MySQL or PostgreSQL shell instance
- Manage your deploy requests
- Bootstrap AI agents (
pscale agent-guide) - …and more!
Install pscale
Install or upgrade the PlanetScale CLI for macOS, Linux, or Windows.
pscale agent-guide --format json. Agent automation commands require pscale 0.292.0 or later; run brew upgrade pscale if agent-guide is unknown. Always pass --format json in automation.
pscale can use the MySQL command-line client to quickly open an interactive shell for a database branch. Optional instructions for installing the MySQL client can be found for each platform below.Getting Started
Make sure to first set up your PlanetScale developer environment. Once you’ve installed thepscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.
Available Commands
Usepscale [command] [command] to start up the pscale CLI in your terminal.
Flags
You may use the following flags with the PlanetScale CLI commands.Service tokens permissions
A complete list of access permissions available for use with service tokens can be found in the PlanetScale API documentation.Service token automation
Runningpscale in CI or an AI agent uses a service token instead of pscale auth login. Provide the token as environment variables (recommended) or as flags on each command; both are equivalent:
PLANETSCALE_ORG, the --org flag on the subcommand, or pscale org switch <org> (which works with a service token):
--service-token flag, required --org, Postgres/Vitess, --format json, API equivalent): org · service-token · database · branch · role · password.
Commands to avoid under a service token
Do not retry these with service-token auth. The failure is by design, not transient. This is the most common cause of agent retry loops.pscale auth check --format json confirms a token is wired up. Expect "authenticated": true, "auth_method": "service_token", and (until an org is set) an action_required status with a NO_ORG issue and a non-zero exit code. Resolve it by passing --org/PLANETSCALE_ORG on your commands.
pscale api fallback for hard-to-parse output
When a command’s human output is hard to parse, prefer --format json, or drop to the raw API with pscale api, which returns the API response verbatim and uses the same token:

