Search⌘ K

Connecting to Database

Explore how to connect to a MySQL database running inside a Docker container through various MySQL clients or Adminer. Understand how to find container IPs, use Docker's virtual network, and access the container shell to manage databases interactively.

Connect to the database using a MySQL client

Once the database container has started, you can use any MySQL client application installed on your host PC to connect to localhost:3306 with the user ID root and password mysecret.

If you don’t have a MySQL client on hand, Adminer is a lightweight PHP-based option. It is also available as a Docker image and can be launched in another terminal with:

docker run \
  -it --rm --name adminer \
  -p 8080:8080 \
  adminer

Practice

  1. Click on the Run button and see the above command in action.

  2. After the Adminer is up, click on the URL in front of “Your app can be found at” or view the app in the “Output” tab.

📌 You will see something ...

Adminer