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 CLIPlanetScale 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-h, --org stringList all audit logs
authlogin, logout-hAuthenticate via console
backupcreate, delete, list, restore, show-h, --org stringManage branch backups
branchcreate, delete, diff, list, promote, refresh-schema, schema, show, switch-h, --org stringManage branches
completionbash, zsh, fish, powershell-hGenerate completion script for specified shell
connect<database_name> <branch_name>--execute string, --execute-env-url string, --execute-protocol string, -h, --host string, --org string, --port string, --remote-addr stringCreate a secure connection to the given database and branch
databasecreate, delete, dump, list, restore-dump, show-hManage databases
deploy-requestclose, create, deploy, diff, list, review, show-hManage deploy request
help-hView help for any command
orglist, show, switch-hManage and switch organizations
passwordcreate, delete, list-h, --org stringManage branch credentials
regionlist--org stringView available regions
service-tokenadd-access, create, delete, delete-access, list, show-access-h --org stringManage access of service tokens
shell<database_name> <branch_name>-h, --local-addr string, --org string, --remote-addr stringOpen a MySQL shell instance to the specified database and branch
signup-hSign 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 June 21, 2022
Help us improve this page
PrivacyTerms© 2022 PlanetScale Inc.