docker icon indicating copy to clipboard operation
docker copied to clipboard

Access denied for user 'nextcloud'@'172.18.0.3' (using password: YES)

Open pyksid opened this issue 5 years ago • 1 comments

Hello,

When I try to create admin user for the first time, I have the following error:

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

I run Docker 19.03.6 on Debian 10.3 server.

I have installed nextcloud with docker-compose with "with-nginx-proxy-self-signed-ssl/mariadb/fpm/" example.

I have set both MYSQL_ROOT_PASSWORD (in docker-compose.yml) and MYSQL_PASSWORD (in db.env) variables.

docker-compose.yml:

version: '3'

services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=test
    env_file:
      - db.env

  app:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_HOST=db
    env_file:
      - db.env
    depends_on:
      - db

  web:
    build: ./web
    restart: always
    volumes:
      - nextcloud:/var/www/html:ro
    environment:
      - VIRTUAL_HOST=xxx.com
    depends_on:
      - app
    networks:
      - proxy-tier
      - default

  proxy:
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - certs:/etc/nginx/certs:ro
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - omgwtfssl

  omgwtfssl:
    image: paulczar/omgwtfssl
    restart: "no"
    volumes:
      - certs:/certs
    environment:
      - SSL_SUBJECT=xxx.com
      - [email protected]
      - SSL_KEY=/certs/xxx.com.key
      - SSL_CSR=/certs/xxx.com.csr
      - SSL_CERT=/certs/xxx.com.crt
    networks:
      - proxy-tier

volumes:
  db:
  nextcloud:
  certs:
  vhost.d:
  html:

networks:
  proxy-tier:

On login page, when I try with differents dbhost, same error appears.

Can you help?

Thanks.

pyksid avatar Feb 21 '20 20:02 pyksid

Your issue might be caused by old docker volumes. Removing those solved the problem for me. You can clean up old docker resources by following the steps here: https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430

TheDevPanda avatar Sep 21 '22 08:09 TheDevPanda

Maybe duplicate of https://github.com/nextcloud/docker/issues/540.

J0WI avatar Apr 04 '23 19:04 J0WI