mcpField
T
Turso CLI

Turso CLI

Official
docs.turso.techDatabases & Data326tursoUpdated 3w ago
RepositoryVisit website

About Turso CLI

turso is the official CLI for Turso, a distributed SQLite service built on LibSQL. Create databases and geographic replicas, manage organizations and auth tokens, and launch interactive SQL shells. Supports embedded replica workflows for edge computing and offline scenarios.

Key features

  1. 01Create, list, and delete databases and their geographic replicas
  2. 02Generate and manage long-lived auth tokens for application connections
  3. 03Launch interactive SQL shell to execute queries and browse data
  4. 04Manage database groups and access permissions

Use cases

  1. 01Set up distributed SQLite replicas globally to reduce application latency
  2. 02Generate temporary database access tokens for development and testing environments
  3. 03Explore and debug database contents directly from the command line

Install

Pick your OS or package manager and run the command in a terminal.

$
brew install tursodatabase/tap/turso

Once installed, runturso --versionto confirm it works.

Example commands

Common commands in the order you’d use them.

01
turso auth login
02
turso db create my-db
03
turso db shell my-db

Details

From the project README

Turso CLI

Go License

This is the command line interface (CLI) to Turso.

Documentation

There is reference documentation available.

For a guided walkthrough, follow the Turso Quickstart docs.

Installation

Package manager
Homebrew (macOS, Linux, WSL)
brew install tursodatabase/tap/turso

Also remember to configure homebrew shell completions if you haven't already done so.

To upgrade an existing installation of the CLI, run:

brew upgrade turso
Install script
curl -sSfL https://get.tur.so/install.sh | bash
Go
go install github.com/tursodatabase/turso-cli/cmd/turso@latest
Building from source
cd cmd/turso && go install

Usage

Authentication

If you are a new user, you can sign up with:

turso auth signup

If you already have an account, authenticate with:

turso auth login

You are taken to a web page in your default browser to authenticate via GitHub. After successfully authenticated, turso auth login receives an access token that is stored on your settings file.

Create database

To create a database with a generated name, run:

turso db create

Or you can specify the name of the database with:

turso db create <database name>

To create a branch from an existing database, run:

turso db branch <source-database> <target-database>
Start SQL shell

You can start an interactive SQL shell similar to sqlite3 with:

turso db shell <database name>
Run SQL command without interactive shell

You can also run a command without using the interactive SQL shell:

turso db shell <database name> <sql query>
Replicate database

First, list available locations and pick a location you want to replicate to:

turso db locations

Then, to replicate a database, run:

turso db replicate <database name> <location>
List databases

To list your databases, run:

turso db list
Delete database
turso db destroy <database name>

Settings

The turso program keeps settings in your local machine in the following base directory in turso/settings.json file:

OSConfig directory
Linux$XDG_CONFIG_HOME or $HOME/.config
macOS$HOME/Library/Application Support/turso

Comments

Markdown supported