Error Connecting to TiDB Using DBeaver: Unable to Establish Connection

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 使用dbeaver连接TiDB报错,无法连接上

| username: TiDBer_uVjJGzqe

I followed the official tutorial to install TiDB and configured a local test cluster. The startup command I used is tiup playground v6.5.1 --db 2 --pd 3 --kv 3, and it started successfully as shown in screenshot 1. However, when I tried to connect using DBeaver, I encountered an error (screenshot 2). The connection information is shown in screenshot 3.

DBeaver can connect to other databases like Oracle, but it can’t connect to TiDB. Is there a configuration issue somewhere?

| username: Kongdom | Original post link

Is it possible that the firewall hasn’t been disabled, or that port 4000 hasn’t been opened? By default, there is no password.

| username: liuis | Original post link

Is the firewall enabled? Try connecting locally via terminal first.

| username: 胡杨树旁 | Original post link

Can it connect locally without issues?

| username: TiDBer_uVjJGzqe | Original post link

The firewall has already been turned off.

| username: TiDBer_uVjJGzqe | Original post link

Installed MySQL on local Linux can be connected, firewall is turned off.

| username: TiDBer_uVjJGzqe | Original post link

Installed MySQL on local Linux can be connected, firewall is turned off.

| username: liuis | Original post link

What do you mean by local MySQL? mysql-client?

| username: ffeenn | Original post link

Open the cmd window and use telnet {ip} 4000 to check.

| username: TiDBer_uVjJGzqe | Original post link

The image is not visible. Please provide the text you need translated.

| username: TiDBer_uVjJGzqe | Original post link

You can connect using this command.

| username: liuis | Original post link

127.0.0.1 …

| username: TiDBer_uVjJGzqe | Original post link

I am wondering if it’s because I installed a local test cluster, so I can’t use remote database software to connect…

| username: TiDBer_uVjJGzqe | Original post link

Yes, it can only connect locally on Linux… Sorry, I don’t really understand this and still don’t know why :smiling_face_with_tear:

| username: ffeenn | Original post link

The port is not accessible. Can you remotely connect to 192.168.104.128 from the host where you executed the telnet command?

| username: ffeenn | Original post link

Execute systemctl status firewalld on this server to check.

| username: TiDBer_uVjJGzqe | Original post link

[root@localhost olivia]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
| username: ffeenn | Original post link

Stop the firewall with systemctl stop firewalld or execute:

firewall-cmd --add-port=4000/tcp --permanent
firewall-cmd --reload

Then try connecting to the database again.

| username: TiDBer_uVjJGzqe | Original post link

After turning off the firewall, I tried cmd telnet and database connection, but couldn’t connect.
With the firewall open on port 4000 and enabled, I also tried cmd telnet and database connection, but still couldn’t connect.

| username: ffeenn | Original post link

netstat -lntp |4000