Skip to content

PlanetScale CLI

Use the PlanetScale CLI to create development branches, open deploy requests, and make non-blocking schema changes directly from your terminal.

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.

Ready to take these commands for a run on the terminal?

Available Commands

Use pscale [command] [command] to start up the pscale CLI in your terminal.

CommandSubcommands/OptionsFlagsDescription
api--help, --org string, --database string, --branch string, --field key=value, --header stringArray, --input string, --method string, --query key=valuePerforms authenticated calls against the PlanetScale API and prints the response to stdout.
audit-loglist--help, --org stringList all audit logs
authlogin, logout--helpAuthenticate via console
backupcreate, delete, list, restore, show--help, --org stringManage branch backups
branchcreate, delete, diff, keyspaces, list, promote, refresh-schema, schema, show, switch, vschema--help, --org stringManage branches
completionbash, zsh, fish, powershell--helpGenerate 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 stringCreate a secure connection to the given database and branch
databasecreate, delete, dump, list, restore-dump, show--helpManage databases
deploy-requestapply, cancel, close, create, deploy, diff, edit, list, revert, review, show, skip-revert--helpManage deploy requests including gated deployments
helpaudit-log, auth, backup, branch, completion, connect, data-import, database, deploy-request, help, org, password, region, service-token, shell, signup--helpView help for any command
orglist, show, switch--helpManage and switch organizations
passwordcreate, delete, list--help, --org stringManage branch credentials
ping--help, --count, -n int, --concurrency int, --provider, -p string --timeout durationCheck latency between your machine and PlanetScale's public regions
regionlist--org stringView available regions
service-tokenadd-access, create, delete, delete-access, list, show-access--help, --org stringManage access of service tokens
shell<database_name> <branch_name>--help, --local-addr string, --org string, --remote-addr stringOpen a MySQL shell instance to the specified database and branch
signup--helpSign up for a new PlanetScale account

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.

Was this page useful?
Last updated on