Skip to main content

Connecting to Self-Hosted Databend using BendSQL

In this tutorial, we will guide you through the process of connecting to a self-hosted Databend instance using BendSQL as the user root.

1

Before You Start

  • Ensure that BendSQL is installed on your machine. See Installing BendSQL for instructions on how to install BendSQL using various package managers.

  • Ensure that your Databend instance has started up successfully.

  • In this tutorial, you will use the root account to connect to Databend. During deployment, uncomment the following lines in the databend-query.toml configuration file to select this account:

    databend-query.toml
    [[query.users]]
    name = "root"
    auth_type = "no_password"
2

Launch BendSQL

To launch BendSQL, enter bendsql directly into your terminal or command prompt.

note

The command bendsql launches and connects BendSQL to the local Databend at 127.0.0.1 using the root user without requiring a password. If you wish to connect to a local Databend with a different user, such as 'eric' with the password 'abc123', use the command bendsql --user eric --password abc123. To view all available arguments and their default values, type bendsql --help.

Alt text

3

Execute Queries

Once connected, you can execute SQL queries in the BendSQL shell. For instance, type SELECT NOW(); to return the current time:

Alt text

4

Quit BendSQL

To quit BendSQL, type quit.

Alt text

Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today