How to access database running on WSL2 from Windows

253 views Asked by At

I use YugabyteDB running on WSL2. My ./yugabyted status shows:

+----------------------------------------------------------------------------------------------------------+
|                                                yugabyted                                                 |
+----------------------------------------------------------------------------------------------------------+
| Status              : Running.                                                                           |
| Replication Factor  : 1                                                                                  |
| YugabyteDB UI       : http://127.0.1.1:15433                                                             |
| JDBC                : jdbc:postgresql://127.0.1.1:5433/yugabyte?user=yugabyte&password=yugabyte          |
| YSQL                : bin/ysqlsh -h 127.0.1.1  -U yugabyte -d yugabyte                                   |
| YCQL                : bin/ycqlsh 127.0.1.1 9042 -u cassandra                                             |

WSL2 uses virtual ethernet so I couldn't access YugabyteDB UI by http://127.0.1.1:15433.

So I used wsl ip addr show and used eth0 address (172.25.78.212/20) to connect to YugabyteDB UI. It works (http://172.25.78.212:15433). So I wanted to connect to database, that's my connection string:

Host=172.25.78.212; Port=5433; Database=yugabyte; Username=yugabyte; Password=yugabyte

But I cannot. I get SocketException that says:

A connection cannot be established because the target computer actively refuses to connect

So how can I access the database running on WSL2 from Windows? I use Ubuntu22.04 (as WSL2).

0

There are 0 answers