Possible to copy data files between two MariaDB installations?


I want to set up my Nextcloud server new on new Raspbian OS, and of course I want to keep the data. The version of mariadb differs on old and new Raspbian OS:
old: mariadb Ver 15.1 Distrib 10.1.48-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
new: mariadb Ver
15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (aarch64) using EditLine wrapper

My idea is to just copy the related data base files from old to new system, in my case this would be the directory /var/lib/mysql/owncloud/ (because once I migrated from Owncloud to Nextcloud).
Should this work or is it better to dump and import the tables? If so, then this way?

mysqldump --single-transaction -u owncloud -p[password] owncloud > nextcloud-sqlbkp.bak
mysql -u owncloud -p[password] owncloud < nextcloud-sqlbkp.bak

Like described on Backup — Nextcloud latest Administration Manual latest documentation and Restoring backup — Nextcloud latest Administration Manual latest documentation

I am not sure this will work. It might work flawlessly, and it might fail. However I recommend to setup a completely new NC instance on the new Raspbian server, and then use the Nextcloud Migration tool/feature, to move everything cleanly. That way, you can have excactly the architecture you likes, independant of your current setup.

Do you mean the migration tool for moving between servers mentioned on Migration - Nextcloud? It is available since Nextcloud 24, but unfortunately my source instance is version 20…

My source instance is installed on a RaspberryPi2 with stretch OS and now I want to set it up new on a RaspberryPi3 with bullseye OS 64 Bit. Therefore I plan to install exactly the same Nextcloud version on the new system, put my data there and then update Nextcloud by the usual iteratons version by version in order to reach the current version 25.

Good point. However I expects that you could get that to work, but it will be a loong and struggling effort.

My take on it?

If using serverside encryption: Copy all user data through the nextcloud interface to have it “externally” unencrypted.

Install newest NC from scratch using the NCPI script, as that will install all you needs, in the best optimized, tuned and tweaked way for the Raspberry PI. Then create your users by hand or export them and create them by scripting wiith OCC commands on the new instance. Then move user data from old to new, folder by folder (can easily be scripted aswell).

setup the webserver, database server and install all the x64 PHP libraries, and then copy the entire nextcloud folder to your new rig. Dump SQL as you have written, and import on new rig. Edit config.php to align it with the new environment. Make your webserver configurations manually (use the old as template) and work it from there. When you think you are ready, test OCC and set to maintenance mode. If successfully setting maintenance mode, try deactivate all but core apps and set maintenance mode off. If you can login to NC: Great! Now try to activate apps one by one. When all is activated: Start upgrade process.