Moving nextcloud

Hi,
I was using Nexctloud 20.0.5 a server. I had to move the cloud to another server.
I copied the nextcloud folder
And upload the mysql database.

Running nextcloud again, I am surprised to see some errors ?? and apparently the problem seems to be that some users have been created by nextcloud ( oc_user1, oc_user2, etc… )
If I do manually, but cannot work properly…

Just transfering the " nextcloud.sql" database is not enough ???
Is there a specific procedure to re install an existing cloud ??
I am not an expert and I am confused of these users. I would imagine that just the single sql database should enough ?
or do you think that the problem could be somewhere else ?

THanks in advance for your help
Steve

yo also need to make the same sql user with the same password

Thanks for your reply…
Do you mean that I need to copy also the “mysql.sql” database ??
I thought that all the nextcloud users were defined into the main SQL nextcloud database ( in my example nextcloud.sql )

For info, on the new server, I have reinstalled a freshinstall of nextcloud sounds to be OK… I copy the complet folder of my old nextcloud to the new server, upload the backuped database, and I have the message :
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

But the log doesn’t say much… :frowning:

hi @steve376 see this :
https://docs.nextcloud.com/server/20/admin_manual/maintenance/backup.html

and :
https://docs.nextcloud.com/server/20/admin_manual/maintenance/restore.html

sudo -u www-data php occ maintenance:mode --on
sudo rsync -av /var/www/nextcloud/ ~/nextcloud-copy
sudo mysqldump --single-transaction -u [username] -p [db_name] > nextcloud.bak
sudo rsync -av nextcloud-copy/ /var/www/nextcloud/

This steps are to recreate database configuration ( use the same DBname / username and password than the original DB) :
sudo mysql -u root -p
CREATE USER nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

sudo mysql -u [username] -p [db_name] < nextcloud.bak

1 Like

Hi,
sounds on the right direction :slight_smile:

I can see now, the login page. Sounds promissing… but I soon as I login, I have this error message

=============
The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details

Remote Address: 109.190.102.xx
Request ID: s5uyTAYKehMXDycaW2r9

========================
i had a look on the log file and I have this

[Sun Feb 14 22:06:21.410903 2021] [php7:notice] [pid 5328] [client 109.190.102.xx:35746] {“reqId”:“3aXCfjkUYGOjajYaPX2Q”,“level”:3,“time”:“2021-02-14T21:06:21+00:00”,“remoteAddr”:“109.190.102.xx”,“user”:"–",“app”:“no app in context”,“method”:“GET”,“url”:"/index.php",“message”:“JSCombiner: unable to cache: merged-template-prepend.js”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“20.0.5.2”}, referer: https://cloud.aztgp.net/
[Sun Feb 14 22:06:21.470999 2021] [php7:notice] [pid 5328] [client 109.190.102.84:35746] {“reqId”:“3aXCfjkUYGOjajYaPX2Q”,“level”:3,“time”:“2021-02-14T21:06:21+00:00”,“remoteAddr”:“109.190.102.xx”,“user”:"–",“app”:“PHP”,“method”:“GET”,“url”:"/index.php",“message”:“fopen(/var/www/html/cloud2/nextcloud/data/nextcloud.log): failed to open stream: No such file or directory at /var/www/html/data-mount/nextcloud/nextcloud/lib/private/Log/File.php#85”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“20.0.5.2”}, referer: https://cloud.aztgp.net/

Effecively, the path : /var/www/html/cloud2/nextcloud/data/nextcloud.log
Doesn’t exist and should be :slight_smile:/var/www/html/data-mount/nextcloud/nextcloud/lib/private/Log/File.php

At this place, there is a file called File.php with 644 rights, like on the old server…
Could it be just a log file which doesn’t allow me to start nextcloud ???

===============

Only PHP upgraded from 7.2.24 -> 7.3.19 the rest is the same version Mariadb : 10.3.27

Thanks

@steve376 have you move your data directory to the same location as the original?
File.php is a script for create logs inside the file nextcloud.log

have you done this comands after migration ?

sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 750 /var/www/nextcloud/

if your data directory is not in nextcloud directory :

sudo chown -R root:www-data /datadirectory
sudo chmod -R 770 /datadirectory