turso
Setup
macOS:
CODEBLOCK0
Linux/WSL:
CODEBLOCK1
Verify installation:
CODEBLOCK2
Always use --output json flag when calling commands programmatically (where supported).
Authentication
CODEBLOCK3
Get auth token:
CODEBLOCK4
Resources
Databases
| Command | Description |
|---|
| INLINECODE1 | List all databases |
| INLINECODE2 |
Create a new database |
|
turso db create <name> --group <group> | Create database in a specific group |
|
turso db destroy <name> | Destroy a database |
|
turso db show <name> | Show database details and URL |
|
turso db shell <name> | Open interactive SQL shell |
|
turso db shell <name> "SELECT * FROM users" | Run a SQL query directly |
|
turso db inspect <name> | Inspect database size and usage |
|
turso db tokens create <name> | Create an auth token for a database |
|
turso db tokens create <name> --expiration none | Create a non-expiring token |
Groups
| Command | Description |
|---|
| INLINECODE11 | List all groups |
| INLINECODE12 |
Create a new group |
|
turso group create <name> --location <location> | Create group in specific location |
|
turso group add-location <name> <location> | Add a replica location to a group |
|
turso group remove-location <name> <location> | Remove a replica location |
|
turso group destroy <name> | Destroy a group |
Organizations
| Command | Description |
|---|
| INLINECODE17 | List organizations |
| INLINECODE18 |
Switch to a different organization |
Plan
| Command | Description |
|---|
| INLINECODE19 | Show current plan details |
| INLINECODE20 |
Upgrade your plan |
Global Flags
| Flag | Description |
|---|
| INLINECODE21 | Output result as JSON |
| INLINECODE22 |
Disable colored output |
turso
设置
macOS:
bash
brew install tursodatabase/tap/turso
Linux/WSL:
bash
curl -sSfL https://get.tur.so/install.sh | bash
验证安装:
bash
turso --version
以编程方式调用命令时(在支持的情况下),始终使用 --output json 标志。
身份验证
bash
turso auth login
获取身份验证令牌:
bash
turso auth token
资源
数据库
| 命令 | 描述 |
|---|
| turso db list | 列出所有数据库 |
| turso db create <名称> |
创建新数据库 |
| turso db create <名称> --group <组> | 在特定组中创建数据库 |
| turso db destroy <名称> | 销毁数据库 |
| turso db show <名称> | 显示数据库详情和URL |
| turso db shell <名称> | 打开交互式SQL终端 |
| turso db shell <名称> SELECT * FROM users | 直接运行SQL查询 |
| turso db inspect <名称> | 检查数据库大小和使用情况 |
| turso db tokens create <名称> | 为数据库创建身份验证令牌 |
| turso db tokens create <名称> --expiration none | 创建永不过期的令牌 |
组
| 命令 | 描述 |
|---|
| turso group list | 列出所有组 |
| turso group create <名称> |
创建新组 |
| turso group create <名称> --location <位置> | 在特定位置创建组 |
| turso group add-location <名称> <位置> | 向组添加副本位置 |
| turso group remove-location <名称> <位置> | 移除副本位置 |
| turso group destroy <名称> | 销毁组 |
组织
| 命令 | 描述 |
|---|
| turso org list | 列出组织 |
| turso org switch <名称> |
切换到其他组织 |
套餐
| 命令 | 描述 |
|---|
| turso plan show | 显示当前套餐详情 |
| turso plan upgrade |
升级套餐 |
全局标志
| 标志 | 描述 |
|---|
| --output json | 以JSON格式输出结果 |
| --no-color |
禁用彩色输出 |