Skip to main content
bunny.net Database Shell The Bunny Database Shell (bsql) is a standalone, interactive SQL shell for querying and managing your database from the terminal. It supports dot-commands, multiple output formats, sensitive column masking, and persistent history. In this quickstart you will learn how to:
  • Install the Database Shell
  • Connect to a remote Bunny Database
  • Execute queries interactively and non-interactively
Bunny Database is currently in Public Preview. Features and APIs may evolve during this period.
Already using the Bunny CLI? The same shell is built in as bunny db shell, which resolves your database and credentials automatically:
See bunny db for the full command reference.

Quickstart

1

Retrieve database credentials

You will need an existing database to continue. If you don’t have one, create one.Navigate to Dashboard > Edge Platform > Database > [Select Database] > Access to find your database URL and generate an access token.
You should store these as environment variables to keep them secure.
2

Install the Database Shell

Install the Database Shell globally using npm:
3

Connect to your database

Start an interactive shell session:
If you store your credentials in a .env file as BUNNY_DATABASE_URL and BUNNY_DATABASE_AUTH_TOKEN, you can connect without passing any flags:
See Authorization for more on environment variables.
4

Execute a query

Run a SQL query directly in the shell:
You can also execute a query without entering interactive mode:

CLI Flags

Execute a SQL file

You can execute a .sql file directly from the command line:

Output modes

Change the output format using the --mode flag or the .mode dot-command inside an interactive session:

Dot-commands

The following dot-commands are available inside an interactive session:

Sensitive column masking

Columns matching patterns like password, secret, api_key, auth_token, and ssn are masked by default. Email columns are partially masked (e.g. a****e@example.com). Toggle masking with .mask / .unmask in interactive mode, or pass --unmask as a CLI flag.

Saved views

Save frequently used queries as named views to recall them later:
Manage saved views with .views, .view NAME, and .unsave NAME.

Browse tables in your browser

If you have the Bunny CLI installed, bunny db studio opens a visual database explorer in your browser for the resolved database:
bunny db studio is experimental and provides a view-only table browser. Use bunny db shell to run queries or modify data.
Like bunny db shell, it resolves the database and credentials automatically, generating a short-lived token when one isn’t already available. The server runs until you stop it with Ctrl+C. See bunny db for the full command reference.
Last modified on July 24, 2026