Connect to running mysql instance

Hello, we have the need to connect from a remote machine to the running mysql container, based on what I research is not so simple to connect to a running mysql inside a container.

Any tips on how to do this?

So basically the issue is, I’ve a server with tutor and all the containers running, and from another host I want to do a remote connection to the database running inside the mysql container.


Indeed, this is not so easy, and that’s on purpose: exposing a database port on the host would create security vulnerabilities and eventual port conflicts. Your best bet is to add a docker-compose.override.yml file to $(tutor config printroot)/env/local/. This file would contain something like:

version: "3"
            - "3306:3306"

You would then be able to connect to your database on port 3306 with the root password given by tutor config printvalue MYSQL_ROOT_PASSWORD.

Note that I did not test this personally, but it should work.

1 Like

Yes, I’m aware about the sec issues, thanks for that.

I will test this and let you know.