I’m developing on a Windows 10 machine using WSL2, where I’ve set up my API along with MariaDB and Redis. I also have MariaDB installed on Windows and use DBeaver, installed on Windows, to manage my databases.
Initially, DBeaver was connecting to the Windows MariaDB instance instead of the one in WSL2. I fixed this by disabling the Windows MariaDB service and setting bind-address = 0.0.0.0 in the WSL2 MariaDB configuration. This allowed DBeaver to connect to the correct MariaDB instance within WSL2.
However, my API is failing to connect to the MariaDB instance within WSL2, returning an ETIMEDOUT error. On my previous Windows 11 machine, this setup worked perfectly (there shouldn’t be any problems with my code). I connected DBeaver using the WSL2 host IP obtained via wsl.exe hostname -I (172.xx.xx.x instead of localhost/127.0.0.1). On Windows 10, however, DBeaver fails to connect to the WSL2 hostname, unless the Windows MariaDB service is stopped (that’s at least understandable for me) and bind-address=0.0.0.0 is set in my.cnf (that’s not 🙂 ).
The main issue is that the API cannot connect to the MariaDB instance inside WSL2, which is critical for my development.
What I’ve Tried:
Disabled the Windows MariaDB service.
Set bind-address = 0.0.0.0 in the WSL2 MariaDB configuration.
Attempted to connect to the WSL2 hostname in DBeaver.
Environment:
Windows 10
WSL2 (kali-linux)
MariaDB installed on both Windows and WSL2, but only WSL2 instance is used
DBeaver for database management (Windows)
API fails with ETIMEDOUT error (API is installed on WSL2)
Any suggestions on resolving the API connection timeout or configuring DBeaver to connect to the WSL2 MariaDB instance would be greatly appreciated.
2