diff --git a/admin_manual/maintenance/backup.rst b/admin_manual/maintenance/backup.rst index 13e4e0cc4..8e2236e73 100644 --- a/admin_manual/maintenance/backup.rst +++ b/admin_manual/maintenance/backup.rst @@ -20,6 +20,8 @@ your Nextcloud environment. You could use this command:: Backup Database --------------- +.. warning:: Before restoring a backup see :doc:`restore` + MySQL/MariaDB ^^^^^^^^^^^^^ diff --git a/admin_manual/maintenance/manual_upgrade.rst b/admin_manual/maintenance/manual_upgrade.rst index cf1cc0037..effc7f701 100644 --- a/admin_manual/maintenance/manual_upgrade.rst +++ b/admin_manual/maintenance/manual_upgrade.rst @@ -16,7 +16,7 @@ The other way is by entering your ``config.php`` file and changing ``'maintenance' => false,`` to ``'maintenance' => true,``. 1. Back up your existing Nextcloud Server database, data directory, and - ``config.php`` file. (See :doc:`backup`.) + ``config.php`` file. (See :doc:`backup`, for restore information see :doc:`restore`) 2. Download and unpack the latest Nextcloud Server release (Archive file) from `nextcloud.com/install/`_ into an empty directory outside of your current installation. @@ -81,11 +81,6 @@ Previous Nextcloud Releases You'll find previous Nextcloud releases in the `Nextcloud Server Changelog `_. -Reverse Upgrade ---------------- - -If you need to reverse your upgrade, see :doc:`restore`. - Troubleshooting --------------- diff --git a/admin_manual/maintenance/restore.rst b/admin_manual/maintenance/restore.rst index 2b0fbc507..6579af943 100644 --- a/admin_manual/maintenance/restore.rst +++ b/admin_manual/maintenance/restore.rst @@ -30,6 +30,38 @@ install and data folder) to your Nextcloud environment. You could use this comma Restore Database ---------------- +Clean Database Before Restoring +=============================== + +.. warning:: Before restoring a backup you need to make sure to delete all existing database tables. + +The easiest way to do this is to drop and recreate the database. +SQLite does this automatically. + +MySQL +^^^^^ + +MySQL is the recommended database engine. To restore MySQL:: + + mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud" + mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud" + +If you use UTF8 with multibyte support (e.g. for emoijs in filenames), use:: + + mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud" + mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" + + +PostgreSQL +^^^^^^^^^^ +:: + + PGPASSWORD="password" psql -h [server] -U [username] -d nextcloud -c "DROP DATABASE \"nextcloud\";" + PGPASSWORD="password" psql -h [server] -U [username] -d nextcloud -c "CREATE DATABASE \"nextcloud\";" + +Restoring +========= + .. note:: This guide assumes that your previous backup is called "nextcloud-sqlbkp.bak"