Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 715
Siema Avatar asked Jun 23 '26 04:06

Siema


1 Answers

I had the same error message at least up to SQLSTATE[HY000]. For me the solution was to put the IP-Adress listed for the maria-db container in the portainer.io GUI in the field host without a port. I also removed and added again the Nextcloud container and Maria-db stack (which automatically adds a container), but I do not think that that did the trick. I followed this guide.

like image 89
MoritzMoreira Avatar answered Jun 25 '26 12:06

MoritzMoreira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!