Skip to main content
To interact with PlanetScale and manage your databases, you can use the pscale CLI to do the following:
  • Create, delete and list your databases and branches
  • Open a secure MySQL shell instance
  • Manage your deploy requests
  • …and more!
Notepscale 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 the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

Available Commands

Use pscale [command] [command] to start up the pscale CLI in your terminal.
CommandSubcommands/OptionsFlagsProductDescription
api--help, --org string, --database string, --branch string, --field key=value, --header stringArray, --input string, --method string, --query key=valueVitess, PostgresPerforms authenticated calls against the PlanetScale API and prints the response to stdout.
audit-loglist--help, --org stringVitess, PostgresList all audit logs
authlogin, logout--helpVitess, PostgresAuthenticate via console
backupcreate, delete, list, restore, show--help, --org stringVitess, PostgresManage branch backups
branchcreate, delete, diff, keyspaces, list, promote, refresh-schema, schema, show, switch, vschema--help, --org stringVitess, PostgresManage branches
completionbash, zsh, fish, powershell--helpVitess, PostgresGenerate completion script for specified shell
connect<database_name> <branch_name>--execute string, --execute-env-url string, --execute-protocol string, --help, --host string, --org string, --port string, --remote-addr string, --role stringVitessCreate a secure connection to the given database and branch
databasecreate, delete, dump, list, restore-dump, show--helpVitess, PostgresManage databases
deploy-requestapply, cancel, close, create, deploy, diff, edit, list, revert, review, show, skip-revert--helpVitessManage deploy requests including gated deployments
helpaudit-log, auth, backup, branch, completion, connect, data-import, database, deploy-request, help, mcp, org, password, ping, region, role, service-token, shell, signup, size, workflow--helpVitess, PostgresView help for any command
orglist, show, switch--helpVitess, PostgresManage and switch organizations
mcpinstall, server--target string, --helpVitess, PostgresInstall and start an MCP server
passwordcreate, delete, list--help, --org stringVitessManage branch credentials
ping--help, --count, -n int, --concurrency int, --provider, -p string --timeout durationVitess, PostgresCheck latency between your machine and PlanetScale’s public regions
regionlist--org stringVitess, PostgresView available regions
rolecreate, delete, get, list, renew, reset-default, update--help, --org string, --inherited-roles string, --ttl duration, --force, --successor string, --name string, --webPostgresManage Postgres roles
service-tokenadd-access, create, delete, delete-access, list, show-access--help, --org stringVitess, PostgresManage access of service tokens
sizecluster list--help, --org string, --region string, --metalVitess, PostgresView available cluster sizes
shell<database_name> <branch_name>--help, --local-addr string, --org string, --remote-addr stringVitess, PostgresOpen a MySQL shell instance to the specified database and branch
signup--helpVitess, PostgresSign up for a new PlanetScale account
workflowcancel, complete, create, cutover, list, retry, reverse-cutover, reverse-traffic, show, switch-traffic, verify-data--help, --org stringVitessManage the workflows for PlanetScale databases

Flags

You may use the following flags with the PlanetScale CLI commands.
FlagDescription
--api-token stringThe API token to use for authenticating against the PlanetScale API
--api-url stringThe base URL for the PlanetScale API. (default “https://api.planetscale.com/“)
--config stringConfig file (default: $HOME/.config/planetscale/pscale.yml)
--debugEnable debug mode
-f, --format stringShow output in specific format. Possible values: [human, json, csv] (default: “human”)
-h, --helpGet more information about a command
--no-colorDisable color output
--service-token stringService Token for authenticating
--service-token-id stringThe Service Token ID for authenticating
--versionShow pscale version

Service tokens permissions

A complete list of access permissions available for use with service tokens can be found in the PlanetScale API documentation.

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.
I