How to connect locally hosted MySQL database with the docker container

Just use host.docker.internal instead of localhost.

To make it work on Linux, you just need to start your Docker container passing the parameter --add-host host.docker.internal:host-gateway

Leave a Comment