I am looking to connect a PhpMyAdmin running in a container (Docker) to a MySQL server running on the host and listening on 127.0.0.1.
However, when I give docker the varuable -e PMA_HOST=127.0.0.1, it only look on it's own Docker network... How would I be able to talk to my host MySQL DB server ?
Here are the steps you can follow to install the Dockerhub MySQL Container: Step 1: Pull the Docker Image for MySQL. Step 2: Deploy and Start the MySQL Container. Step 3: Connect with the Docker MySQL Container.
You only need to open your favourite browser and type the following url: http://localhost:8081/ so your instance of phpMyAdmin will show up. To access, type root as username and the password you established in the step one when running the mysql container (if you followed the tutorial the password is mypass123).
You shouldn't use 127.0.0.1
as IP address to refer to the host as that will point to the docker container where phpAdmin is running.
You need to find the IP address of the host on the docker0
interface as use that ip instead. You can do that using:
-e PMA_HOST=$(ip route show | grep docker0 | awk '{print $9}')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With