-1

I would like to request assistance for an ongoing project. I'm developing an Internet of Things (IoT) application for monitoring temperature and humidity, using the Fiware platform and Docker to run the services. I faced a problem connecting the MySQL database to Grafana due to its default port (3306) being used by the Docker backend. When I uninstall Docker, the MySQL database works correctly using the same port. However, when reinstalling Docker, the functioning of the database is again affected by port occupancy by the backend Docker. I would like to know if there is any solution to reverse this situation and resolve the port conflict. Thanks for the help.

I tried connecting the database in grafana to present data, but it didn't work. The idea is to make the MySQL database recognized in grafana to present the data

1 Answers1

1

If you are managing your Docker containers using Docker Compose, You can define the port mapping in the docker-compose.yml file.

services:
  mysql:
    image: mysql:latest
    ports:
      - "3307:3306"

With this setup, the MySQL container will listen on port 3306 inside the container, but it will be accessible on port 3307 on the host system.

If not,

You can map the Docker port to a different port on the host system. When starting the Docker container that uses port 3306, you can use the -p flag to map it to a different port on the host,

 docker run -p 3307:3306 mysql_image
Melih Sevim
  • 930
  • 6
  • 9