Skip to main content

3 posts tagged with "beginner"

View All Tags

Early this month, I posted introducing bendsql, a CLI tool developed by the Databend team. The tool enables you to connect to your Databend instance, view your databases and tables, and even execute SQL queries in a command line window. However, for a more user-friendly experience, most of us prefer a GUI tool.

DBeaver is one of the most popular data management tools. It is free, open-source, and supports connections to almost all databases. This post explains how to set up a Databend connection with DBeaver. If you're a new Databender and haven't used DBeaver before, I hope this post can get you started.

When you set up a connection in DBeaver, you need to select a database driver. To connect to Databend, you can use the pre-configured MySQL driver, or add the Databend JDBC driver to DBeaver.

Connecting with MySQL Driver

The MySQL driver is a pre-configured database driver in DBeaver, so when you create a connection on Database > New Database Connection, you can select it directly in the connection wizard and proceed.

Alt text

Detailed connection steps are included in the Databend documentation.:

Connecting with Databend JDBC Driver

The Databend JDBC driver is not a pre-configured database driver in DBeaver, so you have to add it to DBeaver using the Driver Manager before using it.

For how to add the driver to DBeaver, refer to

After the driver is added to DBeaver, you can find and select it in the database connection wizard when creating a connection. The connection steps are the same as Connecting with MySQL Driver.

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. 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.

Downloading and Installing bendsql

To download and install bendsql, please go to the bendsql repository on GitHub and follow the README instructions.

Connecting to Databend

Use bendsql connect to connect to a Databend instance:

eric@ericdeMacBook rsdoc % bendsql connect -h
Connect to Databend Instance

bendsql connect [flags]

-d, --database string (default "default")
-H, --host string (default "localhost")
-p, --password string
-P, --port int (default 8000)
-u, --user string (default "root")

--help Show help for command

Use 'bendsql <command> <subcommand> --help' for more information about a command.

To connect to a local Databend, simply run bendsql connect:

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:

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)

This blog walks you through the process of deploying a single instance of Databend on MinIO. MinIO is an object storage solution that is lightweight and easy to operate. Databend is a modern data warehouse designed for cloud architecture, built with Rust and open-source. It provides rapid elastic scaling and aims to create an on-demand, pay-as-you-go data cloud product experience.

Open-Source Repo:

Databend Docs:

Databend Architecture

Databend is architecturally divided into three layers: Meta Service Layer, Query Layer, and Storage Layer.

  • Meta Service Layer

This layer stores permission definitions, table structure definitions, transaction management, table and data association, and the overall logic of data sharing. Cluster deployment is recommended for a production environment.

  • Query layer

This layer interacts directly with users and their storage. They interact with Databend through SQL, and the Query Layer reads from and writes to the storage layer after receiving their requests. This layer is not always online and can be pulled up when needed. Scale up and down are allowed in this layer.

  • Storage Layer

The Databend storage layer is the Databend Fuse Engine and supports for cloud and self-built object storage. Databend uses the Parquet format to store data block with min/max indexing, sparse indexing, bloom indexing, etc.

Supported Deployment Platforms

Google GCSYes
Azure BlobYes
Aliyun OSSYes
Tencent COSYes

Detailed reference:

Deploying a Single Instance of Databend

Compared to the Databend deployment, a MinIO environment is easier to set up. In a production environment, MinIO Cloud or AWS S3 environment is recommended for a hassle-free experience.

The following uses the MinIO + Databend standalone deployment in Linux of x64 as an example:

databend/data/databendmysql: 3307
http: 8000
ClickHouse http: 8124

Deploy MinIO

Download MinIO from the official website and start it by running the following commands:

cd /data
mkdir minio
cd minio
export MINIO_ROOT_USER=minioadmin
export MINIO_ROOT_PASSWORD=minioadmin
./minio server ./data./minio server --address :9900 ./data

Use the MinIO Admin web interface to create a bucket named as "databend":

After creating the bucket, the MinIO deployment is complete.

Download and Install Databend

- databend-version-nightly-x86_64-unknown-linux-musl.tar.gzLinux for x64
- databend-version-nightly-aarch64-apple-darwin.tar.gzMacOS of M1
- databend-version-nightly-aarch64-unknown-linux-musl.tar.gzLinux of Arm
- databend-version-nightly-x86_64-apple-darwin.tar.gzMacOS of X64
- source codesrc

We can download the musl package for Linux from the Databend open-source project repo:

The latest version is always recommended as Databend develops and merges new features on a daily basis. For example, if you're running Linux on an x86_64 machine, you can download version v0.9.51-nightly like this:

cd /data
mkdir databend
export ver=v0.9.51-nightly
cd databend
tar zxvf ../databend-$ver-x86_64-unknown-linux-musl.tar.gz

sudo mkdir /var/log/databend
sudo mkdir /var/lib/databend
sudo chown -R $USER /var/log/databend
sudo chown -R $USER /var/lib/databend

The Databend installation files are extracted to a directory named "databend".

Configure Databend

You need to configure Databend after the installation. The default configuration file for databend-query is included with the download. You can modify this file as follows:

vim configs/databend-query.toml


# Storage config.[storage]
# fs | s3 | azblob | obs
type = "s3"
# Set a local folder to store your data.
# Comment out this block if you're NOT using local file system as storage.
data_path = "/var/lib/databend/data"
# To use S3-compatible object storage, uncomment this block and set your values.
bucket = "databend"
endpoint_url = ""
access_key_id = "minioadmin"
secret_access_key = "minioadmin"

Start and Stop Databend

To start Databend, run the following command:


To check that Databend is running, you can use the following command:

ps axu |grep databend

To stop Databend, run the following command:


Connect to Databend

Databend has three external service ports by default:

  • MySQL: 3307 supports MySQL cli and application connection.
  • ClickHouse: 8124 ClickHouse http handler protocol
  • http prot: 8000 The Databend HTTP handler is a REST API

To connect to Databend using the MySQL client, run the following command:

mysql -h -P3307 -uroot

Note that the root user can log in without a password from localhost. Databend permission management refers to the design of MySQL 8.0 and allows you to manage Databend users in the same way as MySQL 8.0 user management.

ClickHouse protocol using:

You're all set up now. Use Databend as you're with MySQL.

Other Resources