Nextcloud Snap: snap mariadb prevents normal install/use of host mariadb

Nextcloud version (eg, 20.0.5): 27.1.6
Operating system and version (eg, Ubuntu 20.04): Ubuntu 23.10
Apache or nginx version (eg, Apache 2.4.25): whatever comes with the Snap
PHP version (eg, 7.4): whatever comes with the Snap

The issue you are facing:
I did a clean install of Ubuntu from scratch, and one of the first things I did after making the Welcome messages go away was install the snap version of Nextcloud. Everything was fine until I decided to toss Wordpress on the same machine. When I attempted to install MariaDB (since the snap won’t allow its own MariaDB to be shared, and I don’t want it to be shared anyway), I discovered that they cannot apparently co-exist.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

1. Install Nextcloud snap version
2. Try to install or use MariaDB on the host machine
3. Suffer at your desires frustrated

The output of your Nextcloud log in Admin > Logging:

N/A It either runs without issue if only Nextcloud is running, or doesn't run at all when it is not.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'instanceid' => 'ockene9wlexz',
  'passwordsalt' => 'h93cueiVsBIIr17k0ZPid172UXR7Kc',
  'secret' => 'H523Tyy53K6+h5DdPyD+d7mqMXArsfE3tD2R8qlg+XXj1wPG',
  'trusted_domains' => 
  array (
    0 => 'nextfoundry',
    1 => '127.0.0.1',
    2 => 'nextcloud.myurl.org',
    3 => '192.168.4.20',
    4 => '192.168.4.21',
    5 => '192.168.4.30',
    6 => '192.168.4.36',
    7 => '192.168.4.45',
    8 => '192.168.4.46',
    9 => '192.168.4.87',
  ),
  'datadirectory' => '/media/myemail/Vault/nextcloud/data/',
  'dbtype' => 'mysql',
  'version' => '27.1.6.2',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://127.0.0.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypasswordhash',
  'installed' => true,
  'maintenance' => false,
  'mail_from_address' => 'myemail',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'myurl.org',
  'mail_smtpport' => '1025',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpstreamoptions' => 
  array (
    'ssl' => 
    array (
      'allow_self_signed' => true,
      'verify_peer' => false,
      'verify_peer_name' => false,
    ),
  ),
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'myemail@myurl.org',
  'mail_smtppassword' => '7rEst0WoKkoOT0t2HroM2Q',
  'skeletondirectory' => '/media/myemail/Vault/nextcloud/data/skeleton',
  'localstorage.allowsymlinks' => true,
  'loglevel' => 2,
);```

The output of your Apache/nginx/system log in `/var/log/____`:

AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
[Sun Feb 11 21:09:33.356596 2024] [ssl:warn] [pid 3222303:tid 140436844537024] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Feb 11 21:09:33.361792 2024] [lbmethod_heartbeat:notice] [pid 3222303:tid 140436844537024] AH02282: No slotmem from mod_heartmonitor
[Sun Feb 11 21:09:33.363132 2024] [mpm_event:notice] [pid 3222303:tid 140436844537024] AH00489: Apache/2.4.58 (Unix) OpenSSL/1.1.1 configured – resuming normal operations
[Sun Feb 11 21:09:33.363168 2024] [core:notice] [pid 3222303:tid 140436844537024] AH00094: Command line: ‘httpd -d /snap/nextcloud/40228 -D EnableCompression -D FOREGROUND’
[Sun Feb 11 21:09:33.369656 2024] [unixd:alert] [pid 3222304:tid 140436844537024] AH02155: getpwuid: couldn’t determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Feb 11 21:09:33.378269 2024] [unixd:alert] [pid 3222306:tid 140436844537024] AH02155: getpwuid: couldn’t determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Feb 11 21:09:33.411186 2024] [unixd:alert] [pid 3222305:tid 140436844537024] AH02155: getpwuid: couldn’t determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Feb 11 21:09:39.383852 2024] [unixd:alert] [pid 3222732:tid 140436844537024] AH02155: getpwuid: couldn’t determine user name from uid 4294967295, you probably need to modify the User directive

I’m assuming that what’s going on is that the Snap’s install of the DB is using all the same stuff that the host system would normally use by default.

If that is indeed the case: I feel like the Nextcloud Snap should be using alternate ports/sockets than the default, in case someone would like to have more than one application that uses a database.

If not, I would be delighted to be educated on how to solve my little problem.

I did already try altering the host/port/sockets, both using snap set and by adjusting the config.php. This appeared to do nothing at all - by which I mean, when I close and re-open the config, it’s back to how it was set previously, even if I verify that the changes occurred (save file, close file, reopen file, verify changes, close file, reopen file, changes are reverted). I’m guessing that snap manages the config file on its own?

And before someone tells me I should understand snap better: Snap is supposed to be the solution for people who aren’t as technically savvy. If I wanted to do things the manual/difficult way, I would not be using Snap. I would just install all the stuff from scratch, like I did with my previous NC installs.