I don't know what I'm doing wrong


First of all: I’m quite new to this so my real problem is propably not really understanding what I’m doing. Thanks a lot in advance for helping me learning!

I’m installing Nextcloud om my Synology NAS using Docker and following this guide: Synology: How to Install Nextcloud Using Docker – Marius Hosting

All goes well until step 10, where I get this error: “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 ‘Stefan’@‘’ (using password: YES)”

I’m fairly sure I’m using the right credentials (I’m using Bitwarden so I’m just c/p’ing). What can I do to solve this?

Thanks again!


Is Stefan really your nextclouduser in MariaDB? Can your Nextcloud conntect to MariaDB with

1 Like

Thanks @devnull !

This is what I used in the Stack code in Portainer:

version: '2'

    container_name: mariadb
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-read-only-compressed=OFF
    restart: always
      - mariadb:/var/lib/mysql
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_PASSWORD=mysqlpassword
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=Stefan

    container_name: nextcloud
      - 8082:80
      - mariadb
      - PUID=1026
      - PGID=100
      - TZ=Europe/Brussels
      - /volume1/docker/nextcloud/html:/var/www/html
      - /volume1/docker/nextcloud/custom_apps:/var/www/html/custom_apps
      - /volume1/docker/nextcloud/config:/var/www/html/config
      - /volume1/docker/nextcloud/data:/var/www/html/data
      - /volume1/docker/nextcloud/themes:/var/www/html/themes/
    image: nextcloud
    restart: always

  mariadb: # nextcloud

How can I check wether Nextcloud can reach MariaDB on that address? In my understanding Nextcloud isn’t yet installed on my system since I’m stuck on step 10 of the guide I’m following.

Thanks again!

Before step 10 the nextcloud software (e.g. php files) is on the system. With step 10 the install script (e.g. php) connects the database and create in the database the structures. Also the settings are saved in config/config.php .

Try using mariadb:10.3.22

If that works, google it. I can’t find the reference now, but I’m still using that version to avoid the issue you have.

1 Like

This is my config.php:

$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
  'instanceid' => 'ocqqei6g73um',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => '',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',

I think your nextcloud container can not connect to

'dbhost' => 'mariadb',

Can you set here the ip address or a correct name? Is it mariadb?
Can your nextcloud connect the database?
I think the dbport can be empty.

Read the documentation.