Database connection failed

I installed NC based on docker. All containers will start properly but when running the first time installation I cannot connect to the database. The following error message comes up in the UI:

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 'ncuser'@'' (using password: NO)

In the docker-compose.yml I applied environment values for the settings and apply these ones in the first time install UI.

I bashed into the database container but was not able to connect to the database either. I tried this with mysql -u root@ with the password set as “MYSQL_ROOT_PASSWORD” in the environment variables.

Any idea on how to fix this permission issue and finally get nextcloud installed?

did you try docker-compose file provided at docker hub? once it works you can adopt and expend it for your needs…

I took it from Nextcloud Server – mit Docker Compose und Traefik installieren | goNeuland which is based on the official docker-compose file from docker hub.
I need such file because I need to run NC behind a traefik reverse proxy.

the problem you have is completely unrelated to reverse proxy and other enhanced settings - as long you can’t interact with the database from local bash the problem is inside/related to this container.

try starting with only this container (maybe in a fresh directory) - once your DB works continue with Nextcloud app container - for the first testing you can expose in locally with http only, once it works and you can access the website and DB access works you can add reverse proxy and other fancy stuff…

Thanks, will give it a try.

I found the reason for my issue: I missed to delete the local volumes in my docker environment before starting the containers over and over again…Layer 8 issue :wink:

1 Like

I signed up just so I could thank you for the advice.
I was stuck at the same point, I’ve deleted the previous volume and voila. running.