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?
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.
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.
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.
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.