Moving database to an external database server - failed

Hello,
I am running nextcloudpi with the data directory mounted from an external server by NFS. So far so good, everything fine and working.
To improve performance and consolidate all data on the NFS server I tried to move the database also to this external server:

occ maintenance:mode --on
/etc/init.d/apache2 stop
mysqldump ...connectiondetails-local-dbserver... > nc.sql
mysql ...connectiondetails-remote-dbserver... < nc.sql
# edit config.php with new db-connection details
/etc/init.d/apache2 start
occ maintenance:mode --off

When I access nextcloud afterwards, I get an 500 internal server error and no hint in nextcloud.log, nc-{access,error}.log at all.

Access to the remote database server is ok, moving the database sql into it from the pi works without any problems.

When I switch back to the old database connection in config.php, everything works again.

Any hints?

The point was, that the new (remote) database is MariaDB 10, listening on 3307 and nextcloud is IGNORING the dbport option in config.php. Using
'dbhost' => 'remotehost:3307', 'dbport' => '' instead of 'dbhost' => 'remotehost', 'dbport' => '3307' fixed it.