Error while trying to create admin user: Failed to connect to the database

Hi everyone, I’ve look around 7 posts in the forum related to my issue but none solved ;(

My NextCloud is running on docker with portainer; I’ve already added to cloudflare and nginx and everything is running good.

When I try to login for the first time to config he returns this error:

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 'andrescala'@'172.22.0.3' (using password: YES) 

This is the stack I’m using:

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed

    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=Bund7zXeVz7YnFknLGcnUjHtk #change this
      - MYSQL_PASSWORD=HFdMe9rn5kf7A8Pqc8v86Pre5 #change this
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8888:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=HFdMe9rn5kf7A8Pqc8v86Pre5  #change this to match the mysql_password above
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Don’t know what I can do to solve this!
Thank your for your support.

Kind regards,
Scala

Heeyyy after reading agaaaain all the documentation I’ve realized that I couldn’t SSH my docker with my user! And that gave me the ideia that mayyybe I didn’t add the user to the docker!

So, I’ve SSH as root and then added my user:

1 - sudo groupadd docker
2 - adduser admin
3 - sudo nano /etc/sudoers
3.5 - admin ALL=(ALL:ALL) ALL (added the permitions above the root user)
4 - sudo usermod -a -G docker admin

And voilá!
It’s alive!
/facepalm

PS: Maybe helps someone :slight_smile: