I am trying to migrate my Nextcloud v17 installation from one system to another.
Debian 10 4.19.0-6-amd64
I installed phpmyadmin on both systems. I then exported the nextcloud database from the source host and imported it on the target host. I copied over the nextcloud/config/config.php file.
However, when I run the occ script, it can’t authenticate:
/var/www/nextcloud# su -m www-data -c "php ./occ upgrade" An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000]  Access denied for user 'nextcloud'@'localhost' to database 'nextcloud' in /var/www/nextcloud/lib/private/DB/Connection.php:64
The database username and password are both “nextcloud”. I can log in manually with these credentials:
/var/www/nextcloud# mysql -u nextcloud -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 210 Server version: 10.3.18-MariaDB-0+deb10u1 Debian 10 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
What could be going wrong when the occ script tries to connect? Here is the relevant part of my config:
'dbtype' => 'mysql', 'version' => '17.0.2', 'dbname' => 'nextcloud', 'dbhost' => '127.0.0.1', 'dbtableprefix' => 'oc_', 'dbuser' => 'nextcloud', 'dbpassword' => 'nextcloud',