From aadfc912a314c18cffd2a260fec6ed2268c7c7bf Mon Sep 17 00:00:00 2001 From: soyeric128 Date: Wed, 15 Mar 2023 16:55:39 -0400 Subject: [PATCH 1/4] updates --- docs/doc/01-guides/index.md | 2 +- .../30-access-tool/00-mysql.md | 74 +++++++++++++++++++ .../30-access-tool/01-bendsql.md | 65 ++++++++++++++++ .../30-access-tool/_category_.json | 7 ++ 4 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 docs/doc/11-integrations/30-access-tool/00-mysql.md create mode 100644 docs/doc/11-integrations/30-access-tool/01-bendsql.md create mode 100644 docs/doc/11-integrations/30-access-tool/_category_.json diff --git a/docs/doc/01-guides/index.md b/docs/doc/01-guides/index.md index f45941d248535..557779237cd14 100644 --- a/docs/doc/01-guides/index.md +++ b/docs/doc/01-guides/index.md @@ -18,7 +18,7 @@ These tutorials are intended to help you get started with Databend: * [How to Connect Databend with MySQL Client](../11-integrations/00-api/01-mysql-handler.md) * [How to Connect Databend with ClickHouse HTTP Handler](../11-integrations/00-api/02-clickhouse-handler.md) * [How to Connect Databend with REST API](../11-integrations/00-api/00-rest.md) -* [How to Connect Databend with DBeaver SQL IDE](../11-integrations/20-gui-tool/01-dbeaver.md) +* [How to Connect Databend with DBeaver SQL IDE](../11-integrations/30-access-tool/00-mysql.md) * [How to Execute Queries in Python](../03-develop/01-python.md) * [How to Query Databend in Jupyter Notebooks](../11-integrations/20-gui-tool/00-jupyter.md) * [How to Execute Queries in Golang](../03-develop/00-golang.md) diff --git a/docs/doc/11-integrations/30-access-tool/00-mysql.md b/docs/doc/11-integrations/30-access-tool/00-mysql.md new file mode 100644 index 0000000000000..c29c558c6a28a --- /dev/null +++ b/docs/doc/11-integrations/30-access-tool/00-mysql.md @@ -0,0 +1,74 @@ +--- +title: MySQL-Compatible Clients +sidebar_label: MySQL-Compatible Clients +description: + Connect Databend from MySQL-compatible clients. +--- + +Databend provides support for MySQL compatible CLI and GUI clients where you can connect to Databend and execute queries from. + +:::note +Databend is not a complete implementation of the MySQL protocol, so certain programs such as some ORM frameworks may not be able to connect to Databend. +::: + +To connect to Databend with MySQL compatible clients, you will need to connect to port 3307 with a SQL user created in Databend. + +This example connects to a remote Databend with a SQL user named `databend`: + +```shell +mysql -h172.20.0.2 -udatabend -P3307 -pdatabend +``` + +This example connects to a local Databend with the user `root`: + +```shell +mysql -h127.0.0.1 -uroot -P3307 +``` + +## Built-in Accounts + +There are four built-in accounts in Databend that can be accessed from a local machine without requiring a password. These accounts are immutable and possess the highest level of privileges, meaning their settings cannot be altered or removed. Additionally, it is not possible to change or update their passwords. + +- root@127.0.0.1 +- root@localhost +- default@127.0.0.1 +- default@localhost + +## Default SQL Dialect + +If you have logged into Databend through the MySQL protocol, it is important to note that the default SQL dialect is `PostgreSQL`. If you wish to use `MySQL`, change it by executing the following command: + +```sql +set global sql_dialect='MySQL' +``` + +## Example: Connect from DBeaver + +DBeaver is a universal database management tool for everyone who needs to work with data in a professional way. With DBeaver you are able to manipulate with your data like in a regular spreadsheet, create analytical reports based on records from different data storages, export information in an appropriate format. + +The following steps show how to establish a connection to Databend with DBeaver. + +1. Create a SQL user in Databend. + +```sql +CREATE USER user1 IDENTIFIED BY 'abc123'; +GRANT ALL ON *.* TO user1; +``` + +2. In DBeaver, choose a driver for the new connection. Select `MySQL`, then click **Next**. + +

+ +

+ +3. On the **Connection Settings** screen, configure your connection settings, including: + * Host + * Port + * Database name + * Username and password + +

+ +

+ +4. Click **Test Connection...** to see if the connection works. \ No newline at end of file diff --git a/docs/doc/11-integrations/30-access-tool/01-bendsql.md b/docs/doc/11-integrations/30-access-tool/01-bendsql.md new file mode 100644 index 0000000000000..06bb6152ae3af --- /dev/null +++ b/docs/doc/11-integrations/30-access-tool/01-bendsql.md @@ -0,0 +1,65 @@ +--- +title: bendsql +sidebar_label: bendsql +description: + Databend-native CLI +--- + +[bendsql](https://github.com/databendcloud/bendsql) is a command line tool that has been designed specifically for Databend. It allows users to establish a connection with Databend and execute queries directly from a CLI window. + +This tool is particularly useful for those who prefer a command line interface and need to work with Databend on a regular basis. With bendsql, users can easily and efficiently manage their databases, tables, and data, and perform a wide range of queries and operations with ease. + +## 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) +``` \ No newline at end of file diff --git a/docs/doc/11-integrations/30-access-tool/_category_.json b/docs/doc/11-integrations/30-access-tool/_category_.json new file mode 100644 index 0000000000000..33dc2b4ac366e --- /dev/null +++ b/docs/doc/11-integrations/30-access-tool/_category_.json @@ -0,0 +1,7 @@ +{ + "label": "Clients", + "link": { + "type": "generated-index", + "slug": "/integrations/clients" + } +} \ No newline at end of file From 0e44422afbe3238c1ef3770ec54d298fb5775d4f Mon Sep 17 00:00:00 2001 From: soyeric128 Date: Wed, 15 Mar 2023 16:58:59 -0400 Subject: [PATCH 2/4] Update index.md --- docs/doc/01-guides/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/doc/01-guides/index.md b/docs/doc/01-guides/index.md index 557779237cd14..d3eaba6b9f328 100644 --- a/docs/doc/01-guides/index.md +++ b/docs/doc/01-guides/index.md @@ -18,7 +18,8 @@ These tutorials are intended to help you get started with Databend: * [How to Connect Databend with MySQL Client](../11-integrations/00-api/01-mysql-handler.md) * [How to Connect Databend with ClickHouse HTTP Handler](../11-integrations/00-api/02-clickhouse-handler.md) * [How to Connect Databend with REST API](../11-integrations/00-api/00-rest.md) -* [How to Connect Databend with DBeaver SQL IDE](../11-integrations/30-access-tool/00-mysql.md) +* [How to Connect Databend with MySQL-Compatible Clients](../11-integrations/30-access-tool/00-mysql.md) +* [How to Connect Databend with bendsql](../11-integrations/30-access-tool/01-bendsql.md) * [How to Execute Queries in Python](../03-develop/01-python.md) * [How to Query Databend in Jupyter Notebooks](../11-integrations/20-gui-tool/00-jupyter.md) * [How to Execute Queries in Golang](../03-develop/00-golang.md) From fa2c2f50fcbdb116eec581c66ec180bdc1a05a50 Mon Sep 17 00:00:00 2001 From: soyeric128 Date: Wed, 15 Mar 2023 17:08:46 -0400 Subject: [PATCH 3/4] Delete 01-dbeaver.md --- .../11-integrations/20-gui-tool/01-dbeaver.md | 65 ------------------- 1 file changed, 65 deletions(-) delete mode 100644 docs/doc/11-integrations/20-gui-tool/01-dbeaver.md diff --git a/docs/doc/11-integrations/20-gui-tool/01-dbeaver.md b/docs/doc/11-integrations/20-gui-tool/01-dbeaver.md deleted file mode 100644 index ee130c3c07fcd..0000000000000 --- a/docs/doc/11-integrations/20-gui-tool/01-dbeaver.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Connecting Databend With DBeaver -sidebar_label: DBeaver -description: - Connecting Databend with DBeaver. ---- - - -

- -

- -## What is [DBeaver](https://dbeaver.com/)? - -DBeaver is a universal database management tool for everyone who needs to work with data in a professional way. With DBeaver you are able to manipulate with your data like in a regular spreadsheet, create analytical reports based on records from different data storages, export information in an appropriate format. - - -- From [About DBeaver](https://dbeaver.com/docs/wiki/) - -## DBeaver - -### Create a Databend User - -Connect to Databend server with MySQL client: -```shell -mysql -h127.0.0.1 -uroot -P3307 -``` - -Create a user: -```sql -CREATE USER user1 IDENTIFIED BY 'abc123'; -``` - -Grant privileges for the user: -```sql -GRANT ALL ON *.* TO user1; -``` - -See also [How To Create User](../../14-sql-commands/00-ddl/30-user/01-user-create-user.md). - -### Install DBeaver - -Please refer [DBeaver Installation](https://dbeaver.com/docs/wiki/Installation/) - -### Create DBeaver Connection - -1. Choose a driver for the new connection: click the `MySQL` type in the gallery, then click Next. -

- -

- -2. In the Connection Settings screen, on the General tab, set the primary connection settings: -

- -

- -For most drivers required settings include: -* Host -* Port -* Database name -* Username and password - -3. Query Data -

- -

From 0c7847584c5207f9434eed5f5cbecc39fdf54126 Mon Sep 17 00:00:00 2001 From: BohuTANG Date: Thu, 16 Mar 2023 08:09:59 +0800 Subject: [PATCH 4/4] Update 00-mysql.md --- .../11-integrations/30-access-tool/00-mysql.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/doc/11-integrations/30-access-tool/00-mysql.md b/docs/doc/11-integrations/30-access-tool/00-mysql.md index c29c558c6a28a..e7f5bfd68b104 100644 --- a/docs/doc/11-integrations/30-access-tool/00-mysql.md +++ b/docs/doc/11-integrations/30-access-tool/00-mysql.md @@ -29,18 +29,10 @@ mysql -h127.0.0.1 -uroot -P3307 There are four built-in accounts in Databend that can be accessed from a local machine without requiring a password. These accounts are immutable and possess the highest level of privileges, meaning their settings cannot be altered or removed. Additionally, it is not possible to change or update their passwords. -- root@127.0.0.1 -- root@localhost -- default@127.0.0.1 -- default@localhost - -## Default SQL Dialect - -If you have logged into Databend through the MySQL protocol, it is important to note that the default SQL dialect is `PostgreSQL`. If you wish to use `MySQL`, change it by executing the following command: - -```sql -set global sql_dialect='MySQL' -``` +- `root@127.0.0.1` +- `root@localhost` +- `default@127.0.0.1` +- `default@localhost` ## Example: Connect from DBeaver @@ -71,4 +63,4 @@ GRANT ALL ON *.* TO user1;

-4. Click **Test Connection...** to see if the connection works. \ No newline at end of file +4. Click **Test Connection...** to see if the connection works.