# Source: https://planetscale.com/docs/cli.md

# PlanetScale CLI

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!

<Note>
  `pscale` 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.
</Note>

## Getting Started

Make sure to first [set up your PlanetScale developer environment](/docs/cli/planetscale-environment-setup). 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.

| **Command**                                  | **Subcommands/Options**                                                                                                                                                                                                                      | **Flags**                                                                                                                                                                        | **Product**      | **Description**                                                                                                                                                                        |
| :------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`api`](/docs/cli/api)                       |                                                                                                                                                                                                                                              | `--help`, `--org string`, `--database string`, `--branch string`, `--field key=value`, `--header stringArray`, `--input string`, `--method string`, `--query key=value`          | Vitess, Postgres | Performs authenticated calls against the PlanetScale API and prints the response to stdout.                                                                                            |
| [`audit-log`](/docs/cli/audit-log)           | `list`                                                                                                                                                                                                                                       | `--help`, `--org string`                                                                                                                                                         | Vitess, Postgres | List all [audit logs](/docs/security/audit-log#review-your-organization-audit-log)                                                                                                     |
| [`auth`](/docs/cli/auth)                     | `login`, `logout`                                                                                                                                                                                                                            | `--help`                                                                                                                                                                         | Vitess, Postgres | Authenticate via console                                                                                                                                                               |
| [`backup`](/docs/cli/backup)                 | `create`, `delete`, `list`, `restore`, `show`                                                                                                                                                                                                | `--help`, `--org string`                                                                                                                                                         | Vitess, Postgres | Manage [branch backups](/docs/vitess/backups)                                                                                                                                          |
| [`branch`](/docs/cli/branch)                 | `create`, `delete`, `diff`, `keyspaces`, `list`, `promote`, `refresh-schema`, `schema`, `show`, `switch`, `vschema`                                                                                                                          | `--help`, `--org string`                                                                                                                                                         | Vitess, Postgres | Manage [branches](/docs/vitess/schema-changes/branching)                                                                                                                               |
| [`completion`](/docs/cli/completion)         | `bash`, `zsh`, `fish`, `powershell`                                                                                                                                                                                                          | `--help`                                                                                                                                                                         | Vitess, Postgres | Generate completion script for specified shell                                                                                                                                         |
| [`connect`](/docs/cli/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 string` | Vitess           | Create a [secure connection](/docs/vitess/tutorials/connect-any-application#option-2-connect-using-the-planetscale-proxy) to the given database and branch                             |
| [`database`](/docs/cli/database)             | `create`, `delete`, `dump`, `list`, `restore-dump`, `show`                                                                                                                                                                                   | `--help`                                                                                                                                                                         | Vitess, Postgres | Manage databases                                                                                                                                                                       |
| [`deploy-request`](/docs/cli/deploy-request) | `apply`, `cancel`, `close`, `create`, `deploy`, `diff`, `edit`, `list`, `revert`, `review`, `show`, `skip-revert`                                                                                                                            | `--help`                                                                                                                                                                         | Vitess           | Manage [deploy requests](/docs/vitess/schema-changes/branching#1-create-a-deploy-request) including [gated deployments](/docs/vitess/schema-changes/deploy-requests#gated-deployments) |
| `help`                                       | `audit-log`, `auth`, `backup`, `branch`, `completion`, `connect`, `data-import`, `database`, `deploy-request`, `help`, `mcp`, `org`, `password`, `ping`, `region`, `role`, `service-token`, `shell`, `signup`, `size`, `webhook`, `workflow` | `--help`                                                                                                                                                                         | Vitess, Postgres | View help for any command                                                                                                                                                              |
| [`org`](/docs/cli/org)                       | `list`, `show`, `switch`                                                                                                                                                                                                                     | `--help`                                                                                                                                                                         | Vitess, Postgres | Manage and switch [organizations](/docs/security/access-control)                                                                                                                       |
| [`mcp`](/docs/cli/mcp)                       | `install`, `server`                                                                                                                                                                                                                          | `--target string`, `--help`                                                                                                                                                      | Vitess, Postgres | Install and start an [MCP server](/docs/vitess/connecting/mcp)                                                                                                                         |
| [`password`](/docs/cli/password)             | `create`, `delete`, `list`                                                                                                                                                                                                                   | `--help`, `--org string`                                                                                                                                                         | Vitess           | Manage [branch credentials](/docs/vitess/connecting/connection-strings)                                                                                                                |
| [`ping`](/docs/cli/ping)                     |                                                                                                                                                                                                                                              | `--help`, `--count, -n int`, `--concurrency int`, `--provider, -p string` `--timeout duration`                                                                                   | Vitess, Postgres | Check [latency](/docs/vitess/connecting/network-latency) between your machine and PlanetScale's public regions                                                                         |
| [`region`](/docs/cli/region)                 | `list`                                                                                                                                                                                                                                       | `--org string`                                                                                                                                                                   | Vitess, Postgres | View available [regions](/docs/vitess/regions)                                                                                                                                         |
| [`role`](/docs/cli/role)                     | `create`, `delete`, `get`, `list`, `reassign`, `renew`, `reset`, `reset-default`, `update`                                                                                                                                                   | `--help`, `--org string`, `--inherited-roles string`, `--ttl duration`, `--force`, `--successor string`, `--name string`, `--web`                                                | Postgres         | Manage [Postgres roles](/docs/postgres/connecting/roles)                                                                                                                               |
| [`service-token`](/docs/cli/service-token)   | `add-access`, `create`, `delete`, `delete-access`, `list`, `show-access`                                                                                                                                                                     | `--help`, `--org string`                                                                                                                                                         | Vitess, Postgres | Manage access of [service tokens](/docs/api/reference/service-tokens)                                                                                                                  |
| [`size`](/docs/planetscale-plans)            | `cluster list`                                                                                                                                                                                                                               | `--help`, `--org string`, `--region string`, `--metal`                                                                                                                           | Vitess, Postgres | View available [cluster sizes](/docs/planetscale-plans)                                                                                                                                |
| [`shell`](/docs/cli/shell)                   | `<database_name>` `<branch_name>`                                                                                                                                                                                                            | `--help`, `--local-addr string`, `--org string`, `--remote-addr string`                                                                                                          | Vitess, Postgres | Open a MySQL shell instance to the specified database and branch                                                                                                                       |
| [`signup`](/docs/cli/signup)                 |                                                                                                                                                                                                                                              | `--help`                                                                                                                                                                         | Vitess, Postgres | Sign up for a new PlanetScale account                                                                                                                                                  |
| [`webhook`](/docs/cli/webhook)               | `create`, `delete`, `list`, `show`, `test`, `update`                                                                                                                                                                                         | `--help`, `--org string`, `--events string`, `--url string`, `--enabled`                                                                                                         | Vitess, Postgres | Manage [webhooks](/docs/api/webhooks) for databases                                                                                                                                    |
| [`workflow`](/docs/cli/workflow)             | `cancel`, `complete`, `create`, `cutover`, `list`, `retry`, `reverse-cutover`, `reverse-traffic`, `show`, `switch-traffic`, `verify-data`                                                                                                    | `--help`, `--org string`                                                                                                                                                         | Vitess           | Manage the workflows for PlanetScale databases                                                                                                                                         |

## 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/](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 permissions

A complete list of access permissions available for use with service tokens can be found in the [PlanetScale API documentation](/docs/api/reference/service-tokens#access-permissions).

## Need help?

Get help from [the PlanetScale Support team](https://support.planetscale.com/), or join our [GitHub discussion board](https://github.com/planetscale/discussion/discussions) to see how others are using PlanetScale.


---

> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://planetscale.com/llms.txt