docker icon indicating copy to clipboard operation
docker copied to clipboard

Cannot connect to mysql db

Open d-v opened this issue 6 years ago • 10 comments

Screenshot from 2019-09-25 10-01-36 I'm unable to connect to a mySQL db instance from the web setup. I can connect to the db using the same credentials from both Chrome MySQL Admin and from emma-db. How can I further diagnose? Screenshots attached below Screenshot from 2019-09-25 10-01-09 Screenshot from 2019-09-25 10-01-03 Screenshot from 2019-09-25 10-03-24

d-v avatar Sep 25 '19 17:09 d-v

I tried entering the mysql container and took a look at the mysql logs, no errors there.

d-v avatar Sep 25 '19 17:09 d-v

I was able to play with the docker-compose file to get something that worked. Now, I try to go to localhost:80, but nothing is there. Looks like the matomo instance doesn't get the request either :/ Below is pasted some output.

dima@7356defb6fb2:/truvu/matomo$ docker-compose logs -f
Attaching to matomo_app_1
app_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.3. Set the 'ServerName' directive globally to suppress this message
app_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.3. Set the 'ServerName' directive globally to suppress this message
app_1  | [Wed Sep 25 18:30:17.983605 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.9 configured -- resuming normal operations
app_1  | [Wed Sep 25 18:30:17.983630 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

d-v avatar Sep 25 '19 18:09 d-v

Ended up trying the public ip instead of localhost and that worked.

d-v avatar Sep 25 '19 18:09 d-v

Finally got all the file permissions out of the way and same issue as in the first post... So I have now pulled as a docker image and done from docker-compose, both do not let me connect to a MySQL database that is running. What am I missing here?

d-v avatar Sep 25 '19 20:09 d-v

It s an issue related to the mariadb version. It will works with mysql:5.

cgarnier avatar Oct 16 '19 05:10 cgarnier

I tried with mysql:5 but it did not work

d-v avatar Oct 16 '19 14:10 d-v

Could you paste bin your docker-compose.yml ?

cgarnier avatar Oct 20 '19 08:10 cgarnier

You have to set a MYSQL_ROOT_PASSWORD in docker-compose.yml

RenaudDouze avatar Apr 12 '20 19:04 RenaudDouze

You have to set port in docker compose file

services:
  db:
    image: mariadb
    command: --max-allowed-packet=64MB
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=
    env_file:
      - ./db.env
    ports:
      - "3306:3306"

shaahrokh avatar Sep 02 '20 06:09 shaahrokh

You have to set port in docker compose file

services:
  db:
    image: mariadb
    command: --max-allowed-packet=64MB
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=
    env_file:
      - ./db.env
    ports:
      - "3306:3306"

This worked for me. What's crazy is, Matomo was working just fine before and all of a sudden I needed this fix after updating/pulling a new docker image. But I just added the port in my compose file and now it's working again.

Hukuma1 avatar Dec 01 '21 17:12 Hukuma1