Changing MariaDB socket when hosting multiple DB [Ubuntu]

You have to provide the right socket path in the Nextcloud configuration file (config.php) too. If you want to use a socket connection it should look similar to this:

  'dbname' => 'nextcloud',
  'dbtableprefix' => 'oc_',
  'dbtype' => 'mysql',
  'dbhost' => 'localhost:/<path-to-socket>/mysql.sock',
  'dbuser' => '<dbuser>',
  'dbpassword' => '<password>',