dockerdocker-composemariadbcontainersnextcloud

nextcloud can't create an admin user


error while trying to create the admin user:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'nextcloud'@'172.22.0.6' (using password: YES)

docker-compose.yml

version: '3'

volumes:
  nextcloud-data:
  nextcloud-db:

networks:
  nginx_network:
    external: true

services:

  app:
    image: nextcloud
    restart: always
    volumes:
      - nextcloud-data:/var/www/html
    environment:
      - MYSQL_PASSWORD=test
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
    networks:
      - nginx_network

  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - nextcloud-db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=test
      - MYSQL_PASSWORD=test
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    networks:
      - nginx_network

I couldn't find any similar problems with a solution that works for me and the docker compose seems okay to me


Solution

  • Solution that worked for me:

    1. changed database container's name
    2. deleted all the volumes

    DO NOT SET THE USER AS ROOT normal user is enough

    (also this error shows up if you mistype your credentials between containers)