Nextcloud snap install. Is there a way to use external MySQL server?

I install NC using snap. Currently, the version is: Nextcloud Hub 3 (25.0.3). All things work perfect.

The only thing I do not like is: currently the MySQL server is running on the same server as NC. I have another server running MySQL. Is that possible to config NC to let it using that external MySQL server?

If it is, how can export (using mysqldump) the current database handled by NC snap install?

Thanks.

Hello,

I am no expert but I doubt if this can be done.

Here is what Snap Team says,

The official Nextcloud snap is designed to offer a fully production-ready instance of Nextcloud with minimal setup and maintenance (it updates automatically). If you aren’t a web developer and don’t need to tweak Nextcloud like one, the snap will probably work perfectly for you.

However, the snap is very opinionated. Don’t want to use Apache? Sorry, the snap uses it. Don’t want to use MySQL? Sorry, that’s what the snap uses. Something other than PHP whatever-we’re-using? We picked the version we feel gives the best results. In other words, it’s not very tinker-friendly. We don’t do this to be mean, we do this so that we can reliably update it without your needing to worry about it.

Refer here → Snap or VM? · nextcloud-snap/nextcloud-snap Wiki · GitHub

Reason behind snap is for ease of use. Customization options or modification abilities are very, very limited. Snap is to be used as it is.

However you can try to raise the issue in github with the snap team → GitHub - nextcloud-snap/nextcloud-snap: ☁️📦 Nextcloud packaged as a snap

Thanks.

Not entirely true.
There is instructions on how to edit the config.php in the SNAP, hence it is possible to change DB host. However the process is risky and not supported by the SNAP developers, and you risks that any update processes breaks in the future as the database in the SNAP, will be out of sync when any eventual scripts are running. Add the hassle you will have for the upgrade procedures when the SNAP developers has added commands to modify/enhance database to accomodate new Nextcloud versions. So yes it is possible, but it definately is not recommended.

2 Likes

Thanks. I think I will keep it as is for now.

Maybe you can use something like a netcat tcp tunnel or local ssh port forwarding . But this would require at least the database on localhost to be disabled so that the default port for the tunnel entrance is free. But I think the solution is not beautiful. Whether it works I also do not know. But i don’t use snap. It would be better if you could change the database settings in config.php.

Hello,

Sorry but if one can go that deep, isn’t it better to try VM or AIO deployment?

Those deployment methods are meant for deep customizations and that actually defeats the purpose of snap method.

But for argument’s sake, I guess nothing is impossible with Open Source software. Question is reliability with such unsupported and untested mods.

Thanks.

2 Likes

I agree. That’s why I wrote that the solution is not really nice. :grinning:
I also think that snap should be used if you only need a standard installation.

1 Like

You can change the settings in config.php, however no matter which solution you think of, then using any database engine not the one in the SNAP, is without any support and I will almost certainly guarantee that it will break at some point. Or that it will simply just override with a new config.php and then add the password for the local database with an sed and then it is a broken installation.

Whatever you do, then using any database outside of the SNAP, comes at your own risk, and I would instead recommend you to use a webserver and PHP SNAP, and then install Nextcloud nextcloud in that one. Or use the AIO VM or Docker. So I agree with everyone: Use SNAP as whole package, or go more serious.

3 Likes