I have installed nextcloud onto docker. But I cant create admin

  • Hi

    I have searched around for a solution, but I found none. Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002]

    I followed this docker: https://hub.docker.com/r/linuxserver/nextcloud

    Here is my docker compose:

    ---

    version: "2.1"

    services:

    nextcloud:

    image: ghcr.io/linuxserver/nextcloud

    container_name: nextcloud

    environment:

    - PUID=997

    - PGID=100

    - TZ=Europe/Oslo

    volumes:

    - /srv/dev-disk-by-label-erlendstorageIII/Appdata&Config/Appdata/NextCloud:/config

    - /srv/c57e0988-2559-4f09-8f66-d20da11e999c/Images:/data

    ports:

    - 443:443

    restart: unless-stopped

    • Offizieller Beitrag

    When exactly do you get the error message? Are you trying to connect to an external database?


    If you use sqlite it should work (note the performance warning)


  • I tried using PUID 1000 and I also deleted the nextcloud folder. I try to use sqlite but now I get this error message:


    Error while trying to initialise the database: An exception occurred while executing 'CREATE TABLE oc_migrations (app VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, PRIMARY KEY(app, version))': SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

    • Offizieller Beitrag

    I tried using PUID 1000 and I also deleted the nextcloud folder. I try to use sqlite but now I get this error message:


    Error while trying to initialise the database: An exception occurred while executing 'CREATE TABLE oc_migrations (app VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, PRIMARY KEY(app, version))': SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

    Do you have a PUID user linked to 1000? You never really clarified that.


    Delete your nextcloud data folder, delete your and delete your configuration (/config) and recreate them both and start over. If you only want local access (or you can add external access later)...


    Anything that starts with a **, adjust to your system and delete the **, then upload it with docker-compose or stacks. I'd recommend not using 443 here, as you'll probably want to forward it if you decide to set up secure external access. This will only be a local option.. I think setting it up locally first, then setting up external access is way easier.


    1. Create all the directories and make all adjustments you need in docker-compose (you might want to delete old directories if you can, since you seem to be having issues), then deploy the stack/docker compose file.

    2. When done, go to nextcloud UI (https://ip:450 , must use https and accept security risk)

    3. create admin user/password

    4. Click setup database then mysql database

    user root

    password (see docker-compose)

    database name: nextcloud

    localhost: nextclouddb

    5. Log in (this might take a few minutes as it downloads apps and sets up the database)

  • I used your compose, but in the compose section where it says this:

    Code
    - MYSQL_ROOT_PASSWORD=**YOUR_MYSQL_PASSWORD

    Should I enter a custom password.


    When I enter the nextcloud info in port 450 this is what I get:


    Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve


    This is my current compose:

    version: "2.1"

    services:

    nextcloud:

    image: ghcr.io/linuxserver/nextcloud:latest

    container_name: nextcloud

    environment:

    - PUID=1000

    - PGID=100

    volumes:

    - /srv/dev-disk-by-label-erlendstorageIII/Appdata&Config/Config/NextCloud:/config

    - /srv/c57e0988-2559-4f09-8f66-d20da11e999c/NextCloud:/data

    - TZ=Europe/Oslo

    depends_on:

    - mariadb

    ports:

    - 450:443

    restart: unless-stopped

    mariadb:

    image: ghcr.io/linuxserver/mariadb:latest

    container_name: nextclouddb

    environment:

    - PUID=1000

    - PGID=100

    - MYSQL_ROOT_PASSWORD=**YOUR_MYSQL_PASSWORD

    volumes:

    - /srv/dev-disk-by-label-erlendstorageIII/Appdata&Config/Config/Mariadb:/config

    - TZ=Europe/Oslo

    restart: unless-stopped

    • Offizieller Beitrag

    Unless you want that to be your password... yes.

    • Offizieller Beitrag

    You keep getting SQLite errors... read the docker compose.. it doesn't use SQlite...


    1. Create all the directories and make all adjustments you need in docker-compose (you might want to delete old directories if you can, since you seem to be having issues), then deploy the stack/docker compose file.

    2. When done, go to nextcloud UI (https://ip:450 , must use https and accept security risk)

    3. create admin user/password

    4. Click storage database then mysql database

    user root

    password: (whatever you put in docker-compose)

    database name: nextcloud

    localhost: nextclouddb

    5. Log in (this might take a few minutes as it downloads apps and sets up the database)


    I think that last step might have been less than clear... click Finish Setup after you enter the database info.. not the login button (if it's there... I can't remember to be honest)

    • Offizieller Beitrag

    It should look like the pic below


    Also, why did you put your time zones under volumes? It should have been exactly like I put it (/etc/localtime:/etc/localtime:ro) This makes the container check the host for the time.. and then sets it as read only (so the container can't change the host's timezone)


    Here... if everything you put in that stack you posted is correct... all you need to do is put a mySQL password in this one on line 24, and run it (you might want to delete your other config folders again, cuz what you did there previously is a mess).

  • This is my current compose now:


    version: "2.1"

    services:

    nextcloud:

    image: ghcr.io/linuxserver/nextcloud:latest

    container_name: nextcloud

    environment:

    - PUID=1000

    - PGID=100

    volumes:

    - /srv/dev-disk-by-label-erlendstorageIII/Appdata&Config/Config/NextCloud:/config

    - /srv/c57e0988-2559-4f09-8f66-d20da11e999c/NextCloud:/data

    - /etc/localtime:/etc/localtime:ro

    depends_on:

    - mariadb

    ports:

    - 450:443

    restart: unless-stopped

    mariadb:

    image: ghcr.io/linuxserver/mariadb:latest

    container_name: nextclouddb

    environment:

    - PUID=1000

    - PGID=100

    - MYSQL_ROOT_PASSWORD=**YOUR_MYSQL_System

    volumes:

    - /srv/dev-disk-by-label-erlendstorageIII/Appdata&Config/Config/Mariadb:/config

    - /etc/localtime:/etc/localtime:ro

    restart: unless-stopped


    This is what I get now:

    Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve

    • Offizieller Beitrag

    Ok, dollars to dollars.. Are you reading any of these posts at all?


    Your compose file looks fine (you still don't have a mysql password, but I'm assuming you changed that) You're getting that error because you're not setting up your mysql database.. look at the screen shot.


    Delete your current nextcloud and nextclouddb config and nextcloud data containers


    Recreate all associated folders (unless you want to recreate the docker compose, use the same names)


    Run the compose file again

  • In the compose file I used "system" for pass. I did set up the mysql database but I still get the same error. I deleted all what you said but I still get the same problem.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!