How to use one shared Matomo core for domains with database for each domain

Similar questions has been asked before, but I couldn’t find quite the answer that I’m looking for. The task is pretty standard stuff: I want to track several sites, but don’t want to use the same database for it. So, it is not an option to configure the sites in one single installation. Parallel installations work perfectly fine, but it is a huge maintenance headache and uses a lot of webspace. The documentation describes a method using subdomain-specific config.ini.php files. But I would rather avoid configuring so many subdomains just for this purpose. I tried symlinks which work just fine. Unfortunately, I can’t get the archive to work. /usr/bin/php /var/www/html/matomo-instance/console core:archive --url=someurl does not work and throws a “SQLSTATE[HY000] [2002] No such file or directory” error. Can anybody help?

Thank you very much!

Ok, I’ve just found the solution. Well, not me! It was Gemini that found it. The problem was the symlink to “console”. The file has to be in the child folder. In addition to that these files have to physically in the child folder: index.php, matomo.php, piwik.php. This is not super elegant for updaes, but can easily be fix by running a smal script after updates of Matomo.

Did I miss this part in the documentation or is it really not included? While this seems to be a bit hacky, in real life many agencies or freelancers will need a solution like this.