DiouxX / docker-glpi

Project to deploy GLPI with docker
222 stars 185 forks source link

Host '172.22.0.2' is not allowed to connect to this MySQL server #38

Closed QBANIN closed 3 years ago

QBANIN commented 3 years ago

GLPI deployed with docker- compose. When i try to set mysql server I get this error

image

What am I doing wrong?

DiouxX commented 3 years ago

What is your docker-compose file ? The mysql server is also on docker ?

If yes, the mysql server deployed with docker on the same docker-compose or a different docker deployment ?

QBANIN commented 3 years ago

mysql.env

MYSQL_ROOT_PASSWORD=diouxx
MYSQL_DATABASE=glpidb
MYSQL_USER=glpi_user
MYSQL_PASSWORD=glpi

docker-compose.yml

version: "3.2"

services:
#Mysql Container
  mysql:
    image: mysql:5.7.23
    container_name: mysql
    hostname: mysql
    volumes:
      - /var/lib/mysql:/var/lib/mysql
    env_file:
      - ./mysql.env
    restart: always

#GLPI Container
  glpi:
    image: diouxx/glpi
    container_name : glpi
    hostname: glpi
    ports:
      - "7780:80"
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/www/html/glpi/:/var/www/html/glpi
    environment:
      - TIMEZONE=Europe/Brussels
    restart: always

The only change I made is exposed port number

DiouxX commented 3 years ago

I have tested now and I don't have the databse initialization problem.

2021-08-05_16h54_43

2021-08-05_16h55_03

2021-08-05_16h55_14

Are you sure that the /var/lib/mysql folder is empty ? Is there not data from a previous install ?

Have you tested with another database mapping folder ?

QBANIN commented 3 years ago

Facepalm You're right, /var/lib/mysql was already in use by another mariadb container :)

Everything works fine now. Thanks.

DiouxX commented 3 years ago

I'm glad I could help you :)