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.

PlanetScale CLI

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
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
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 in organizations

To add service tokens for your organization, here's a complete list of access permissions that can be granted to a token:

Token Access PermissionsWhat they control

read_branch

delete_branch

create_branch

CRUD on Branches of a Database

connect_branchConnect to development Branches of a Database
connect_production_branchConnect to production Branches of a Database

read_deploy_request

create_deploy_request

approve_deploy_request

Deploy Requests on Branches of a Database

read_comment

create_comment

Comments of Deploy Requests on Branches of a Database

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 August 1, 2022
Help us improve this page
© 2022 PlanetScale Inc.