Restoring lost database

Hello Everyone.

I have the following problem: While working on my database, I accidentally dropped the Nextcloud database. Is there any known way to recreate the lost data? All other files are still intact. Unfortunately, I activated encryption.

I am using the latest version of stable Nextcloud.

Yes, recreate the database from your regular backups, which you’ve set-up as an experienced adminstrator.

This would have been easy, indeed. Unfortunately, I am neither an experienced admin nor did I set up any backups.

Afaik, a data base cannot be restored without creating regular backups. What you should be able to do is, to make a backup of your config.php file, reinstall Nextcloud from scratch, restore the config.php file and rescan the files on your hard disk. All other data, like contacts or calendars, etc., can most likely not be recovered.

To be honest, I’ve never done this with active encryption, so I personally cannot tell you if this will work or not :wink:


Thank you. Let’s hope for the best. I created a shadow data directory, so I can re-read the data.

Hi - did this work for you? I have a corrupt database and no backup as well. Don’t have calendar, contacts etc. Is it just as easy as moving the config file? Did you need to delete the database login details?

If you had read @j-ed 's solution post, you would have recognized that it says “from scratch”, meaning a new database is being set up. Of course, you can’t do anything with the credentials of a database that is no longer used. So if the newly created database has the same credentials, then they remain the same in the config.php. If the credentials are new, then of course they have to be adjusted in the coffig.php.

What is missing from this thread, however, is that before files can be scanned in again, all users of the old version must be created exactly the same again so that the files can be assigned to the correct user based on the file structure.

Much luck,

Yep thanks.
For anyone else that has this issue, ended up setting up a clean install, going through the set up process with the new database and then setting up the users. After setting up the users, I then changed the user folder to the old users’ folders. After than ran a re-scan and everything appears up and running.

1 Like