In this tutorial, I will show you how to use a graphical user interface (GUI) database client to connect to a database in DDEV running on Windows Subsystem for Linux (WSL2) with Ubuntu.
For this scenario, the setup is as follows:
- Windows is the main operating system with Ubuntu installed via WSL2
- A project with a working database setup that runs on DDEV within Ubuntu
Now the problem is how do we connect to the database?
We can connect through the command line, but it would be easier to use a tool with a graphical interface.
Let’s find out!
🎥 If you don’t feel like reading, you can watch this step-by-step tutorial instead
How to setup DB GUI for DDEV on WSL2
First, let’s spin up the Ubuntu instance with WSL2.
For this tutorial, we’ll use DBeaver. There are several ways you can install it.
You can go to dbeaver.io/download to check them all but I’ll keep it simple and install the Community Edition via snap
:
sudo snap install dbeaver-ce
Now that we have DBeaver installed, let’s change the directory to our project:
cd your-project
Then run the following command to launch DBeaver:
ddev dbeaver
ℹ DDEV will start your project’s Docker containers before opening DBeaver, in case the containers are not already running.
Most likely, DBeaver will ask you to install the drivers for your database. It is important to install them because otherwise, you will not be able to connect, or the database will throw errors.
You can notice that the application was launched through Ubuntu and DDEV has already configured the connection for us.
Happy coding 💜
Let me know what you think about this article in the comments section below.
If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.