title | summary |
---|---|
TiDB Cloud CLI Quick Start |
Learn how to manage TiDB Cloud resources through the TiDB Cloud CLI. |
TiDB Cloud provides a command-line interface (CLI) ticloud
for you to interact with TiDB Cloud from your terminal with a few lines of commands. For example, you can easily perform the following operations using ticloud
:
- Create, delete, and list your clusters.
- Import data to your clusters.
- Export data from your clusters.
Note:
TiDB Cloud CLI is in beta.
- Have a TiDB Cloud account. If you do not have one, sign up for a free trial.
For macOS or Linux, you can install ticloud
using any of the following methods:
-
Install via script (recommended)
curl https://raw.githubusercontent.com/tidbcloud/tidbcloud-cli/main/install.sh | sh
-
Install via TiUP
tiup install cloud
-
Install manually
Download the pre-compiled binaries from the releases page and copy them to your desired location for installation.
-
Install in GitHub Actions
To set up
ticloud
in GitHub Action, usesetup-tidbcloud-cli
.
Install the MySQL command-line client if you do not have it. You can install it via your package manager:
-
Debian-based distributions:
sudo apt-get install mysql-client
-
RPM-based distributions:
sudo yum install mysql
-
macOS:
brew install mysql-client
For Windows, you can install ticloud
using either of the following methods:
-
Install manually
Download the pre-compiled binaries from the releases page and copy them to the desired location for installation.
-
Install in GitHub Actions
To set up
ticloud
in GitHub Actions, usesetup-tidbcloud-cli
.
Install the MySQL command-line client if you do not have it. You can refer to the instructions in MySQL Installer for Windows for the installation. To launch ticloud connect
on Windows, you need to have the directory containing mysql.exe
in the PATH environment variable.
TiDB Cloud Serverless is the best way to get started with TiDB Cloud. In this section, you will learn how to create a TiDB Cloud Serverless cluster with TiDB Cloud CLI.
Before creating a cluster with TiDB Cloud CLI, you need to either create a user profile or log into TiDB Cloud.
-
Create a user profile with your TiDB Cloud API key:
ticloud config create
Warning:
The profile name MUST NOT contain
.
. -
Log into TiDB Cloud with authentication:
ticloud auth login
After successful login, an OAuth token will be assigned to the current profile. If no profiles exist, the token will be assigned to a profile named
default
.
Note:
In the preceding two methods, the TiDB Cloud API key takes precedence over the OAuth token. If both are available, the API key will be used.
To create a TiDB Cloud Serverless cluster, enter the following command, and then follow the CLI prompts to provide the required information:
ticloud serverless create
View all commands available:
ticloud --help
Verify that you are using the latest version:
ticloud version
If not, update to the latest version:
ticloud update
The TiDB Cloud CLI is also available through TiUP, with the component name as cloud
.
View all commands available:
tiup cloud --help
Run commands with tiup cloud <command>
. For example:
tiup cloud serverless create
Update to the latest version by TiUP:
tiup update cloud
Check out CLI reference to explore more features of TiDB Cloud CLI.
If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an issue. Also, we welcome any contributions.