Migrating nc-database & nc-datadir from existing nextcloudpi installation to a new nextcloudpi OS

I had to reinstall my nextcloudpi OS because I thought my SD is broken.

I wasn’t able to create a backup. All I have is the database (USB) and datadir (HDD).

How can I migrate the database to the new installation?

Thanks in advance.

Nextcloud version 19.0.3
Operating system and version: Raspbian recent OS
Apache or nginx version: recent
PHP version 7.3