Restore Nextcloud and MariaDB from local backup

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 24.0.4
Operating system and version (eg, Ubuntu 20.04): Synology DSM 7.2-64570
Apache or nginx version (eg, Apache 2.4.25): apache2
PHP version (eg, 7.4): 8.0.22

The issue you are facing:
Unfortunately I had a system crash but managed to restore all raw data from the hard-drives. Now I want to restore the hole server including nextcloud with mariaDB. Nextcloud and mariaDB are running in two separated docker containers. To set ist up again I used the same NC and mariaDB versions as before. Now the question is how to restore the database as well as all nextcloud data and user configurations with all accounts used before. Just a copy does not work of course…

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. crash the system
  2. restore data from hard drives
  3. set everything up again

The output of your Nextcloud log in Admin > Logging:

does not help here it is just a freshly installed NC

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

previous config.php (replace idtentifiable information with '...':
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
  'instanceid' => '...',
  'passwordsalt' => '...',
  'secret' => '...',
  'trusted_domains' => 
  array (
    0 => '...',
    1 => '...',
    2 => '...',
  'trusted_proxies' => 
  array (
    0 => '...',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '...',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '...',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '...',
  'dbpassword' => '...',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'defaultapp' => 'files',
  'default_phone_region' => 'DE',
  'filelocking.enable' => true,
  'maintenance' => false,
  'app_install_overwrite' => 
  array (
    0 => 'mindmap_app',
    1 => 'whiteboard',
    2 => 'dashboardcharts',
    3 => 'shifts',
  'mail_from_address' => '...',
  'mail_smtpmode' => '...',
  'mail_sendmailmode' => '...',
  'mail_smtphost' => '...',
  'mail_smtpport' => '...',
  'mail_smtpsecure' => 'ssl',
  'mail_domain' => '...',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '...',
  'mail_smtppassword' => '...',

Thanks in advance!

Have you read the manual Restoring backup — Nextcloud latest Administration Manual latest documentation ?

1 Like

Thank you Vincent!
Yes I red the manual - unfortunately I have no backup from the database, just the raw-data and did not found a way to restore everything in the right way…Maybe you have another hint especially for the mariaDB database?

Sorry I did not read your first post carefully. I am not familiar with Docker but if you have all raw data imo you should be able to recreate mariadb docker.

Well thank you again. Just stop docker and copy all raw-data back into the container will end up in an server error for the nextcloud container. The problem here is that the databas (var/lib/docker) in your post is separated into another docker container with mariaDB. Thus nextcloud cannot read the database.
Restoring the mariaDB docker container should be done in parallel to the nextcloud container in such a way that all files and databases are consistent. That are the points I am struggling here.