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.
Command | Subcommands/Options | Flags | Description |
---|---|---|---|
audit-log | list | -h , --org string | List all audit logs |
auth | login , logout | -h | Authenticate via console |
backup | create , delete , list , restore , show | -h , --org string | Manage branch backups |
branch | create , delete , diff , list , promote , refresh-schema , schema , show , switch | -h , --org string | Manage branches |
completion | bash , zsh , fish , powershell | -h | Generate 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 string | Create a secure connection to the given database and branch |
database | create , delete , dump , list , restore-dump , show | -h | Manage databases |
deploy-request | close , create , deploy , diff , list , review , show | -h | Manage deploy request |
help | -h | View help for any command | |
org | list , show , switch | -h | Manage and switch organizations |
password | create , delete , list | -h , --org string | Manage branch credentials |
region | list | --org string | View available regions |
service-token | add-access , create , delete , delete-access , list , show-access | -h --org string | Manage access of service tokens |
shell | <database_name> <branch_name> | -h , --local-addr string , --org string , --remote-addr string | Open a MySQL shell instance to the specified database and branch |
signup | -h | Sign up for a new PlanetScale account |
Flags
You may use the following flags with the PlanetScale CLI commands.
Flag | Description |
---|---|
--api-token string | The API token to use for authenticating against the PlanetScale API |
--api-url string | The base URL for the PlanetScale API. (default "https://api.planetscale.com/") |
--config string | Config file (default: $HOME/.config/planetscale/pscale.yml) |
--debug | Enable debug mode |
-f, --format string | Show output in specific format. Possible values: [human, json, csv] (default: "human") |
-h, --help | Get more information about a command |
--no-color | Disable color output |
--service-token string | Service Token for authenticating |
--service-token-id string | The Service Token ID for authenticating |
--version | Show 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 Permissions | What they control |
---|---|
read_branch delete_branch create_branch | CRUD on Branches of a Database |
connect_branch | Connect to development Branches of a Database |
connect_production_branch | Connect 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.