Nginx error.log: Failed to connect to database after upgrade from stretch to buster

Support intro

Hi, to being able to upgrade NC15 to higher level I upgraded first from stretch to buster on my raspbian OS. Upgrade didn’t upgrade mysql-databases, so /var/lib/mysql was moved to /var/lib/mysql-10.3 and a new instance was created under /var/lib/mysql.
After recovering Nextcloud database via mysqldump on an stretch system and import on buster in the new fresh DB I got mysql with NC-database (SEGINUS_DB) again running.

example

Or for longer, use three backticks above and below the code snippet:

# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 908
Server version: 10.0.28-MariaDB-2+b1 Raspbian testing-staging

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use SEGINUS_DB;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [SEGINUS_DB]> show tables;
+-----------------------------+
| Tables_in_SEGINUS_DB        |
+-----------------------------+
| oc_accounts                 |
...    |
| oc_whats_new                |
+-----------------------------+
67 rows in set (0.00 sec)

MariaDB [SEGINUS_DB]>

But now I can’t login to NC and I found the following messages in the error.log from nginx:
PHP message: PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user ‘root’@‘localhost’ in /var/www/cloud/lib/private/DB/Connection.php:64
I’m not sure relating the user after recovering the database but I tested original user and root, no way.
Under /etc/alternatives I changed the Link for php back to the original php:
php -> /usr/bin/php7.0

Nextcloud version (eg, 15.0.8.1):
Operating system and version : Raspbian GNU/Linux 10 (buster)
Apache or nginx version: nginx version: nginx/1.14.2
PHP version (eg, 7.1): 7.0 and 7.3

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging: unfortunatly not possible

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'yyyy',
  'secret' => 'zzzz',
  'trusted_domains' =>
  array (
    0 => 'seginus.xxx.yy',
  ),
  'datadirectory' => '/var/www/cloud/data',
  'overwrite.cli.url' => 'https://seginus.xxx.yy',
  'dbtype' => 'mysql',
  'version' => '15.0.8.1',
  'dbname' => 'SEGINUS_DB',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'MYSQL-ADMIN', (also root tested)
  'dbpassword' => '****',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'updater.secret' => '****',
);

The output of your Apache/nginx/system log in /var/log/____:

PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in /var/www/cloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/cloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172