Nextcloud installation: Error while trying to create admin user

I am trying to install NC 12 on a Synology DS 216j with Apache 2.2, PHP 5.6, MariaDB 10 following this guide:

After starting the setup I get the following message:
Error while trying to create admin user: Failed to connect to the database: An exception occured in driver:
SQLSTATE[HY000][2002] No such file or directory

Any idea? Thank you very much for your help.

umm… good plan to have your data at home. so welcome to nc!

your error reads to me as if there’s a problem with your database. does it really exist?

Thank you. Problem is solved (MySQL bind only allows as address and MariaDB listens to port 3307)

Yes. Just type in “” at “localhost”. That’s the solve! Thanks alot!


If you use the nextcloud docker image, you need to enter just “db” as hostname.


1 Like

Jesus, I’ve been trying to get this working for hours, and this worked. I wish it was better documented.

I tried with typing it but still it shows connection refused and I created docker image with localhost:8065

Check @rubo77 answer for docker.

Use db as a hostname for the docker or check your docker-compose.yml file to see the database service name and use this service name as a hostname.

1 Like

Thank you !

Well, this was useful. Whatever the reason, localhost:3307 wopuld not work, while did work… Thanks!

Thank you! I know I’m 2 years late to the party but your reply sorted my issue!

I agree with the other poster, the official documentation should explain this better.

It is explained there, How could we enhance the documentation? where did you expect that information elsewhere?

OK, thank you. I hold my hands up the information is there and I missed it!

My suggestion, for noobs like me, would be to lay out the information in the order that the set up screen requests the information as it may be a little simpler to understand.