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

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?

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.

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?

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:

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

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

1 Like

Thanks for your help.

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.

Thanks a lot.

1 Like