1

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

Siema
  • 21
  • 1
  • 7
  • looks like you're trying to create the `admin` database user using the `nextcloud` database user. That doesn't sound right. – Marcus Müller Jan 07 '22 at 21:39
  • @MarcusMüller I'm trying to create a nextcloud admin using the db user via the nextcloud gui – Siema Jan 07 '22 at 21:43
  • yes, but you must have configured something incorrectly, because it tries to create that user using the `nextcloud` user, whereas I bet user management is reserved to `root`. – Marcus Müller Jan 07 '22 at 21:47
  • @MarcusMüller if I try to do it with the root user the same error appears with `'root'@'172.22.0.6'` instead of `'nextcloud'@'172.22.0.6'` – Siema Jan 07 '22 at 21:51
  • I think it isn't a permission error but something else with connecting to the data base – Siema Jan 07 '22 at 21:53
  • It **explicitly** says it's a permission error: "Access denied" – Marcus Müller Jan 07 '22 at 21:54
  • But it denies the permission even for the root user so it has to be something other that just normal user not being able to create something – Siema Jan 07 '22 at 22:20
  • as said, you've not configured it correctly – probably wrong credentials. – Marcus Müller Jan 07 '22 at 22:23
  • The configuration is the one that i posted, the only difference is that i changed the `MYSQL_USER=nextcloud` to `MYSQL_USER=root` and the error is as stated above – Siema Jan 07 '22 at 22:37

1 Answers1

0

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)

Siema
  • 21
  • 1
  • 7