Nextcloud db migration

NethServer Version: NethServer 7.8.2003
Module: nextcloud 19.0.3.1
hello, trying to migrate my nas/router setup to nethserver. i am currently playing around on a test machine trying to get nextcloud up and running. which it is. installing it was quite easy :slight_smile:
database: is there a migration guide which i could not find? had issues with keys being too long. solved it with
sudo mysql -u root -p
use nextcloud;
set global innodb_large_prefix=on;
set global innodb_file_format=Barracuda;

which fixed it the error submitting the next command
mysql -h localhost -u admin -pPASS nextcloud < /mnt/tank/system/backup/nextcloud/nextcloud-sqlbkp_DATE.bak
but it seems my admin/user passwords dont work anymore… even tough i see two users displayed in the neth nextc. admin panel.
can someone point me in the right direction on how one migrates a sql backup?
thanks, philip

Did you activate the admin user in NethServer?
And your -pPASS shouldn’t that be -p PASS (with a space between p and P)

admin user under system->users? nope never touched that. nextcloud with my user name and admin user were working before i imported the db. the mysql import process worked. -pPASS was without a space
so my basic approach was correct?
empty nextcloud database that neth created
set it to barracuda
import the backup into the nextcloud db

ill play around with it again in a couple of hours…

hmm… wish there would be a nextcloud migration guide out there for nethserver… seems like nethserver is taking over user managment for nextc.?
still cant login after importing nextclouds database. i can however create a new user with occ and that login works then. just not for the user that is in the db that i am importing.
i have not read up on that ldap user managment thing. thought i dont need it cause its just my small server for myself. is that thing controlling nextcloud users? anyways i activated it and created my username… did not change much
any help would be nice. thanks phil

Sorry for late answer. NethServer autoconfigures the LDAP/AD users in Nextcloud.
How many users do you have?
I think best way is to create/import the users to NethServer LDAP/AD and copy the files afterwards and let NC scan for files.

hey, its just me :slight_smile: - one user. im ok with scanning / copying over the user files. but how do i import my exisiting centos8, nextcloud 19 mariadb with my current username?
importing the db in the terminal completes without errors, but somehow looses the password along the process, so that i cant login.

Don’t import the DB, it does not work.
Just create your user in LDAP/AD and it will be available in NC. Then copy the files.

To recreate the wrongly imported Nextcloud DB just drop it and run:

signal-event nethserver-nextcloud-update

but that just creates a empty nextcloud instance without any user data, right? by copying the files, are you referring to my files stored in nextc.? thats fine i could just copy them over inside nc user interface. i am talking bout all the user data stored in the db. contacts, news feeds etc.

Did you try to reset your users password?

sudo -u apache scl enable rh-php73 -- php -dmemory_limit=512M /usr/share/nextcloud/occ user:resetpassword <username>

The admin user from the command is a mysql user you created? NethServer configures Nextcloud with mysql user named nextcloud (you can find the info in the dbuser and dbpassword settings form /usr/share/nextcloud/config/config.php, password can also be found at /var/lib/nethserver/secrets/nextcloud)

If you install an account provider (AD/LDAP), yes. Haven’t tried but I think in such scenario both AD/LDAP users and native nextcloud users can coexist as long as usernames/user_ids do not clash, but it can become a mess when usernames collide.

Sorry, cannot confirm nor deny.

User data is under /var/lib/nethserver/nextcloud directory.

What is the name of the user that is not working? If it is admin it might be clashing with another user.

Related: backup and restore info from nextcloud manual.

1 Like

Me too but I thought instead of risking DB and user mapping problems just recreate the 1 or 2 users but I was not aware of the application data.

@tmp501

Hi

You can export the calendar / contacts from nextcloud. If in doubt, use a Mac or Thunderbird, also to verify. Both can import / export CalDAV and CrdDAV very well. Export all contacts into one vCard, same with Calendar data. Then reimport.

Otherwise stick to MrMarkuz suggsetions.

My 2 cents
Andy

awesome thanks - that worked! can log in with my user and db is serving the previous imported data.
so to recollect when i repeat that on the production machine.
install nc module

db drop & create

mysql -h localhost -u admin -pPASS -e “DROP DATABASE nextcloud”
mysql -h localhost -u admin -pPASS -e “CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci”

The admin user from the command is a mysql user you created?

actually i never created an admin account on ns. but there is a admin account inside the db that i am importing. so im not quite sure why that worked. ill switch admin with nextcloud the next time?

### import db
mysql -h localhost -u admin -p`PASS` nextcloud < /mnt/tank/system/backup/nextcloud/nextcloud-sqlbkp_`DATE`.bak
sudo mysql -u root -p
use nextcloud;
set global innodb_large_prefix=on;
set global innodb_file_format=Barracuda;

reset pass

sudo -u apache scl enable rh-php73 – php -dmemory_limit=512M /usr/share/nextcloud/occ user:resetpassword

If you install an account provider (AD/LDAP), yes. Haven’t tried but I think in such scenario both AD/LDAP users and native nextcloud users can coexist as long as usernames/user_ids do not clash, but it can become a mess when usernames collide.

ill read up on that ldap thing. the only thing i know about that is it probably has something todo with user profle management or so… i am the only user on this machine. so do i really need that? the main purpose of this machine is to serve files, and since a couple of years nextcloud plus to stream music.
thanks all for the help!

I think it works because the nextcloud db user with permissions to access nextcloud db is still there.

This should work too:

mysql nextcloud < /mnt/tank/system/backup/nextcloud/nextcloud-sqlbkp_DATE.bak
mysql
...

If you don’t want more services or applications you won’t need it.

LDAP/AD provides a central user base that’s used by many Nethserver applications.

cool, thank you!

6 posts were split to a new topic: Nextcloud letsencrypt certificate