Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection timed out

To give you a bit of a background:

I’m planning to rearrange my home media server. Instead of doing anything stupid and ruining my current setup, I’m hosting an Ubuntu Server VM with bridged networking, so it acts as a separate server instead of using a VLAN.
I’m trying to set up Nextcloud using Docker inside Portainer.

I’ve already set up the container for MariaDB and the container for Nextcloud.

However, when I’m trying to create the admin user, it gives me this error:
Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection timed out

It’s also important to note that I’ve never played around with Docker before, I’m new to the whole topic. Also, whenever I tried installing Nextcloud before (outside of Docker) I ran into some problem, so I’ve never succeeded.

I want it to be different now, I won’t let this go!

Can someone please help me? Feel free to ask anything about the setup, I’ll try to answer your questions if I can.

Thank you in advance!

hey @pfoldvari and welcome to the communityforum of NC.

whenever I read “docker” these days and understand “freshman” I am trying to get ppl into NC All-in-one (AiO). It’s a really well maintained setup for everyone liking easy setups and low maintenance- servers.

It’s almost guaranteed to have a running system in the end.

Just sayin’

Hi Jimmy,
Thank you for your response!

I’ve seen the AIO version as well, I just didn’t think I’d need so many features.
It’s worth a try though, fortunately my server has got the horsepower to be able to handle it.

I’ll try it that way :slight_smile:

1 Like

Post your Compose file.

I’m having essentially the same issue, giving me an error saying: “Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] Operation timed out”. This happens 30 seconds after clicking the “install” button.

I’m using one docker compose file to start up nextcloud and the associated database. When first setting up NC, I use my IP address and the external port (3308) to connect.

Any help would be greatly appreciated.

For reference, here’s my compose file:

volumes:
  nextcloud:
  db:

services:
  db:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: nextcloud_db
    restart: always
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - PUID=1000
      - PGID=1000
      - TZ=America/Chicago
    ports:
      - 3308:3306

  app:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: nextcloud
    restart: always
    ports:
      - 8443:80
    links:
      - db
    volumes:
      - ./config:/config
      - /Elements/cloud:/cloud
    environment:
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - PUID=1000
      - PGID=1000
      - TZ=America/Chicago