| title | TiDB Cloud CLI Reference |
|---|---|
| summary | Provides an overview of TiDB Cloud CLI. |
Note:
Currently, TiDB Cloud CLI is in beta and not applicable to TiDB Cloud Dedicated clusters.
TiDB Cloud CLI is a command line interface, which allows you to operate TiDB Cloud from your terminal with a few lines of commands. In the TiDB Cloud CLI, you can easily manage your TiDB Cloud clusters, import data to your clusters, and perform more operations.
Make sure to first set up your TiDB Cloud CLI environment. Once you have installed the ticloud CLI, you can use it to manage your TiDB Cloud clusters from the command lines.
The following table lists the commands available for the TiDB Cloud CLI.
To use the ticloud CLI in your terminal, run ticloud [command] [subcommand]. If you are using TiUP, use tiup cloud [command] [subcommand] instead.
| Command | Subcommand | Description |
|---|---|---|
| auth | login, logout, whoami | Login and logout |
| serverless (alias: s) | create, delete, describe, list, update, spending-limit, region, shell | Manage {{{ .starter }}} or {{{ .essential }}} cluster |
| serverless branch | create, delete, describe, list, shell | Manage branches for your {{{ .starter }}} or {{{ .essential }}} cluster |
| serverless import | cancel, describe, list, start | Manage import tasks for your {{{ .starter }}} or {{{ .essential }}} cluster |
| serverless export | create, describe, list, cancel, download | Manage export tasks for your {{{ .starter }}} or {{{ .essential }}} cluster |
| serverless sql-user | create, list, delete, update | Manage SQL users for your {{{ .starter }}} or {{{ .essential }}} cluster |
| serverless audit-log | config, describe, filter-rule (alias: filter), download | Manage database audit logging for your {{{ .starter }}} or {{{ .essential }}} cluster |
| completion | bash, fish, powershell, zsh | Generate completion script for specified shell |
| config | create, delete, describe, edit, list, set, use | Configure user profiles |
| project | list | Manage projects |
| upgrade | - | Update the CLI to the latest version |
| help | auth, config, serverless, project, upgrade, help, completion | View help for any command |
The TiDB Cloud CLI provides two modes for some commands for easy use:
-
Interactive mode
You can run a command without flags (such as
ticloud config create), and the CLI prompts you for input. -
Non-interactive mode
You must provide all arguments and flags that are required when running a command, such as
ticloud config create --profile-name <profile-name> --public-key <public-key> --private-key <private-key>.
For the TiDB Cloud CLI, a user profile is a collection of properties associated with a user, including the profile name, public key, private key, and OAuth token. To use TiDB Cloud CLI, you must have a user profile.
Use ticloud config create to create a user profile.
Use ticloud auth login to assign OAuth token to the current profile. If no profiles exist, a profile named default will be created automatically.
Note:
In the preceding two methods, the TiDB Cloud API key takes precedence over the OAuth token. If both are available in the current profile, the API key will be used.
Use ticloud config list to list all user profiles.
An example output is as follows:
Profile Name
default (active)
dev
staging
In this example output, the user profile default is currently active.
Use ticloud config describe to get the properties of a user profile.
An example output is as follows:
{
"private-key": "xxxxxxx-xxx-xxxxx-xxx-xxxxx",
"public-key": "Uxxxxxxx"
}Use ticloud config set to set properties in a user profile.
Use ticloud config use to switch to another user profile.
An example output is as follows:
Current profile has been changed to default
Use ticloud config edit to open the configuration file for editing.
Use ticloud config delete to delete a user profile.
The following table lists the global flags for the TiDB Cloud CLI.
| Flag | Description | Required | Note |
|---|---|---|---|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active user profile used in this command. | No | Works in both non-interactive and interactive modes. |
| -D, --debug | Enable debug mode | No | Works in both non-interactive and interactive modes. |
If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an issue. Also, we welcome any contributions.