Using dbport leads to error

in config/config.php you can specify both dbhost and dbport.
Assume that your mysql/mariadb instance is listening on port 3307, it would be natural (to me at least) declaring something like:

  'dbhost' => '',
  'dbport' => '3307',

this leads to an internal server error (not logged anywhere).
I catched the error thoough ./occ which stated:

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'nextcloud'@'localhost' (using password: YES) in /var/www/html/nextcloud/lib/private/DB/Connection.php:68

The correct configuration is:

  'dbhost' => '',
  'dbport' => '',


  • dbport is never used except lib/private/Setup/AbstractDatabase.php
  • dbport is not present in config.sample.php
  • dbport is injected in config.php by setup process
1 Like

Where is dbport mentioned in the documentation? I don’t recall seeing it but if it’s there it needs to be removed.

Isn’t in the docs, it’s in the config/config.php file.

I don’t recall seeing this either… do you mean the sample config.php?

Nope, was in config.php after setup.

Bah, so it is.

Can you open a bug report on github? :slight_smile:

1 Like