Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work - Cannot connect to DB #353

Closed
cosad3s opened this issue Mar 4, 2024 · 2 comments
Closed

Does not work - Cannot connect to DB #353

cosad3s opened this issue Mar 4, 2024 · 2 comments

Comments

@cosad3s
Copy link

cosad3s commented Mar 4, 2024

I use the nginx configuration.

Attempt 1: docker-compose up - first error is db-1 | 2024-03-04 11:04:15+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified db-1 | You need to specify one of MARIADB_ROOT_PASSWORD, MARIADB_ROOT_PASSWORD_HASH, MARIADB_ALLOW_EMPTY_ROOT_PASSWORD and MARIADB_RANDOM_ROOT_PASSWORD

Attempt 2: set MARIADB_ROOT_PASSWORD=matomodb in db.env, then after trying to connect on the page http://localhost.:8080/index.php?action=databaseSetup, I got an error:

  • Impossible de se connecter au serveur de la base de données: Accès à la base de données refusé
  • In Docker logs: db-1 | 2024-03-04 11:05:28 6 [Warning] Access denied for user 'matomo'@'%' to database 'matomo'

In the meantime, I had to use another docker-compose.yml sample from this blogpost, if anyone is interested (just update the Matomo version) https://datmt.com/backend/running-matomo-using-docker-compose/

@J0WI
Copy link
Collaborator

J0WI commented Mar 29, 2024

You must also set the MYSQL_PASSWORD for the matomo user.

@cosad3s
Copy link
Author

cosad3s commented Mar 30, 2024

I have tested with following db.env:

MYSQL_PASSWORD=matomodb
MYSQL_DATABASE=matomodb
MYSQL_USER=matomo
MATOMO_DATABASE_ADAPTER=mysql
MATOMO_DATABASE_TABLES_PREFIX=matomo_
MATOMO_DATABASE_USERNAME=matomo
MATOMO_DATABASE_PASSWORD=matomodb
MATOMO_DATABASE_DBNAME=matomo
MARIADB_AUTO_UPGRADE=1
MARIADB_INITDB_SKIP_TZINFO=1
MARIADB_ROOT_PASSWORD=matomodb
MYSQL_ROOT_PASSWORD=matomodb

No success.

But anyway, I found another way to run Matomo in Docker with following Docker Compose:

version: "3"

services:
  matomo_db:
    image: mariadb:10.6
    container_name: matomo_db
    command: --max-allowed-packet=64MB
    restart: always
    volumes:
      - /app/data/matomo/db:/var/lib/mysql
    env_file: 
      - ./matomo.env 

  matomo_app:
    image: matomo:4.11.0-apache
    container_name: matomo_app
    restart: always
    depends_on: 
      - matomo_db
    volumes:
      - /app/data/matomo/web:/var/www/html

    env_file: 
      - ./matomo.env 

    ports:
      - 8080:80

And configuration matomo.env:

MYSQL_ROOT_PASSWORD=REDACTED
MYSQL_DATABASE=matomo_tracking
MATOMO_DATABASE_HOST=matomo_db
MATOMO_DATABASE_USERNAME=root
MATOMO_DATABASE_PASSWORD=REDACTED
MATOMO_DATABASE_DBNAME=matomo_tracking

@cosad3s cosad3s closed this as completed Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants