📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

ti db create-db-sql-users



Creates or repairs three ti-managed SQL users for a TiDB Cloud Starter instance: read-only, read-write, and admin. It stores their credentials locally so that later commands can select the appropriate user with --read-only, --read-write, or --admin.

These users have the following predefined access levels and built-in TiDB Cloud roles:

ti access modeTiDB Cloud built-in roleIntended use
read_onlyrole_readonlyQuery and verify data without modifying it
read_writerole_readwriteQuery and modify application data
adminrole_adminMake schema changes and manage privileges

For the TiDB Cloud role model, see Manage Database Users and Roles.

ti stores the generated usernames and passwords in ~/.ti/db_users/<cluster-id>/credentials, with separate TOML sections for the three access modes. On systems that support POSIX permissions, the credentials file is readable and writable only by its owner.

Syntax

ti db create-db-sql-users --db-cluster-id <string> [--dry-run] [--help] [--version]

Options

  • --db-cluster-id <string>: Starter DB cluster ID. [required]
  • --dry-run: Validate the request without applying changes.
  • --help: Display help information.
  • --version: Display version information.

For options shared by all commands, see Global options.

Examples

  • Create the managed SQL users:

    # Create or reconcile the read-only, read-write, and admin SQL users. ti db create-db-sql-users --db-cluster-id "<cluster-id>"
  • Preview SQL user creation:

    # Show the three managed roles without changing SQL users or local credentials. ti db create-db-sql-users --db-cluster-id "<cluster-id>" --dry-run

Was this page helpful?