--- title: Connecting to Databend and Running Queries with bendsql description: Introducing the CLI tool bendsql slug: category-engineering/bendsql date: 2023-03-02 tags: [beginner] category: Engineering cover_url: bendsql-cover.png image: bendsql-cover.png authors: - Eric --- Recently, the Databend team made the CLI tool "bendsql" available to Databend users. The tool was rolled out last year and provided a command-line alternative to connect to [Databend Cloud](https://www.databend.com/). Now, the team has extended its capabilities by allowing connections to Databend. This post walks you through the installation process and basic commands of bendsql. {/* truncate */} ## Downloading and Installing bendsql To download and install bendsql, please go to the [bendsql](https://github.com/databendcloud/bendsql) repository on GitHub and follow the README instructions. ## Connecting to Databend Use `bendsql connect` to connect to a Databend instance: ```shell eric@ericdeMacBook rsdoc % bendsql connect -h Connect to Databend Instance USAGE bendsql connect [flags] FLAGS -d, --database string (default "default") -H, --host string (default "localhost") -p, --password string -P, --port int (default 8000) --ssl -u, --user string (default "root") INHERITED FLAGS --help Show help for command LEARN MORE Use 'bendsql --help' for more information about a command. ``` To connect to a local Databend, simply run `bendsql connect`: ```shell eric@ericdeMacBook rsdoc % bendsql connect Connected to Databend on Host: localhost Version: DatabendQuery v0.9.58-nightly-790be61(rust-1.68.0-nightly-2023-03-01T16:41:18.376657Z) ``` ## Running Queries with bendsql After connecting bendsql to your Databend instance, you can use `bendsql query` to run queries with the tool: ```shell eric@ericdeMacBook rsdoc % bendsql query Connected with driver databend (DatabendQuery v0.9.58-nightly-790be61(rust-1.68.0-nightly-2023-03-01T16:41:18.376657Z)) Type "help" for help. dd:root@localhost/default=> SELECT NOW(); +------------------------+ | now() | +------------------------+ | 2023-03-02T21:47:10.4Z | +------------------------+ (1 row) ```