Reconnect to existing MariaDB

Hi, (I am new here, so bare with me if I missed some rules)

I am trying to reconnect a fresh NextCloud ( to my existing NC DB stored in MariaDB10, after I had to migrate to a new NAS.

What I fail atm is to locate a logfile that would tell me what is wrong. All I have is

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Additional information:

  1. the System is a QNAP NAS TS 664 running latest Firmware 5.0.1
  2. Apchache80 (Apache with PHP 8.0) is working fine.
  3. MariaDB10 is installed and working fine, listening on port 3306 (socket: /var/run/mariadb10.sock)
  4. phpMyAdmin is running fine and I can see and access the existing NC db.
  5. A new installation of NC using SQLITE is working fine.
  6. I tried replacing the new config.php with the old one from the old NAS, but that causes the above error.

I tried to fix this by restoring the old data/appdata-… folder to have a matching instanceid without success.

I can see that passwordsalt & secret differ from the working sqlite installation but here I am lost.

Is this rather a problem accessing the DB or rendering the WebUI?
What logfile should I be looking at?
Where should I increase the loglevel?

Your ideas and help is highly appreceated.


Ok. Maybe you can use this setting and read than this. There you can find configurations like this:

  "dbtype"        => "mysql",
  "dbname"        => "nextcloud",
  "dbuser"        => "username",
  "dbpassword"    => "password",
  "dbhost"        => "localhost",
  "dbtableprefix" => "oc_",

Now you maybe can use parts of your old database settings and parts of your new database.

You find Nextcloud logs a /path/to/nextcloud/data/nextcloud.log . Post logs.

1 Like

the db-section in the config.php seems to be working fine.
the proposed tests in the docs are returning correct values.
As I have a thunderbird-calender configured I just realized that it does not complain about any connectivity-problems.

nextcloud.log does not show anything, but some old msgs about the updater (when sqlite was in use)

So I think we are “just” seeing the WebUI to fail starting.
How can I verify “passwordsalt” and “secret”


The salt is not important here, as we do not even get any NC screen, esp. not the login screen.
I guess that appiels to the “secret” as well.

Seems I am wrong on a working calendar connection. So forget the above thoughts we are still at “no log information” available.


switching back to sqlite gives me a usable UI.
I now tried to create a new connection to MariaDB editing the config.php that worked with sqlite, but the result is the same.

‘occ status’ outputs:

 /opt/Apache80/bin/php occ status
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused in /share/CACHEDEV1_DATA/.qpkg/NextCloud80/nextcloud/lib/private/DB/Connection.php:139
Stack trace:
#0 /share/CACHEDEV1_DATA/.qpkg/NextCloud80/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()