# Connecting MySQL in Docker container via client application (e.g., MySQL workbench)

**URL:** <https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786>\
**Category:** Tutor Help\
**Tags:** how-to, tutor\
**Created:** [August 28, 2024, 9:05am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786 "2024-08-28T09:05:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![N\_V](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/n_v/32/7090_2.png) [@N\_V](https://discuss.openedx.org/u/N_V)\
**Post date:** [August 28, 2024, 9:05am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/1 "2024-08-28T09:05:12Z")

</div>

Hi, I am new to OpenEDX, and I am setting up a development environment for my project.

Connecting via command prompt (“tutor dev do sql shell”) is successful. We tried to use MySQL Workbench to connect MySQL in the docker container. It does not successful though we get IP address from “tutor inspect [container\_name].”

I have a few questions regarding this situation:

1. Is it correct to get IP address of MySQL via “tutor inspect [container\_name]”?
2. Is there any possible way to connect client application (GUI) to MySQL in Docker container?

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [August 28, 2024, 11:34am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/2 "2024-08-28T11:34:27Z")

</div>

Hi @N_V!  
The MySQL container created by Tutor does not expose its ports to the outside, so you will not be able to connect to from an external application out of the box.

---

<div class="post-metadata">

**Author:** ![N\_V](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/n_v/32/7090_2.png) [@N\_V](https://discuss.openedx.org/u/N_V)\
**Post date:** [August 28, 2024, 12:23pm UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/3 "2024-08-28T12:23:04Z")

</div>

Thanks a lot.

I guess if I expose the port in docker, then it is possible access MySQL in the container. (Sorry for my naive idea)

Have you ever tried to test this idea in your local machine?

---

<div class="post-metadata">

**Author:** ![hinakhadim](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/hinakhadim/32/5954_2.png) [@hinakhadim](https://discuss.openedx.org/u/hinakhadim)\
**Post date:** [August 29, 2024, 5:11am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/4 "2024-08-29T05:11:22Z")

</div>

If you are running Tutor on your machine, then you can expose ports of MySQL by creating a `docker-compose.override.yml` file in `env/local` folder and adding the below contents:

```auto
version: '3.7'
services:
  mysql:
    ports:
      - "3306:3306"

```

Note: Don’t expose the port in the production environment due to security concerns.

---

<div class="post-metadata">

**Author:** ![N\_V](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/n_v/32/7090_2.png) [@N\_V](https://discuss.openedx.org/u/N_V)\
**Post date:** [August 29, 2024, 10:29am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/5 "2024-08-29T10:29:02Z")

</div>

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [August 30, 2024, 2:05pm UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/6 "2024-08-30T14:05:07Z")

</div>

Just an additional comment, please do not do any of these in production, as it may expose your data seriously. As a matter of fact, in production I wouldn’t use the Tutor’s MySQL. Instead, it’s better to use a database service or a specific cluster.

---

<div class="post-metadata">

**Author:** ![N\_V](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/n_v/32/7090_2.png) [@N\_V](https://discuss.openedx.org/u/N_V)\
**Post date:** [September 3, 2024, 3:41am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/7 "2024-09-03T03:41:20Z")

</div>

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/e/e0015f89e879bc75925b71fd11133ab15fe98297.png) [@system](https://discuss.openedx.org/u/system)\
**Post date:** [December 2, 2024, 3:41am UTC](https://discuss.openedx.org/t/connecting-mysql-in-docker-container-via-client-application-e-g-mysql-workbench/13786/8 "2024-12-02T03:41:24Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
