Skip to content

Commit 5cfca2c

Browse files
authored
Merge pull request #14878 from nextcloud/backport/14850/stable34
[stable34] fix(docs): add dedicated MariaDB backup/restore sections
2 parents a00ad03 + 005bd27 commit 5cfca2c

2 files changed

Lines changed: 37 additions & 9 deletions

File tree

admin_manual/maintenance/backup.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,28 @@ Backup database
4040

4141
.. warning:: Before restoring a backup see :doc:`restore`
4242

43-
MySQL/MariaDB
44-
^^^^^^^^^^^^^
43+
MariaDB
44+
^^^^^^^
4545

46-
MySQL or MariaDB, which is a drop-in MySQL replacement, is the recommended
47-
database engine. To backup **MySQL**::
46+
MariaDB is the recommended database engine. To backup MariaDB using `mariadb-dump <https://mariadb.com/docs/server/clients-and-utilities/backup-restore-and-import-clients/mariadb-dump>`_::
47+
48+
mariadb-dump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
49+
50+
If you have enabled MariaDB 4-byte support (:doc:`../configuration_database/mysql_4byte_support`, needed for emoji), add ``--default-character-set=utf8mb4``::
51+
52+
mariadb-dump --single-transaction --default-character-set=utf8mb4 -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
53+
54+
MySQL
55+
^^^^^
56+
57+
To backup MySQL::
4858

4959
mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
5060

51-
If you use enabled MySQL/MariaDB 4-byte support (:doc:`../configuration_database/mysql_4byte_support`, needed for emoji), you will need to add ``--default-character-set=utf8mb4`` like this::
61+
If you have enabled MySQL 4-byte support (:doc:`../configuration_database/mysql_4byte_support`, needed for emoji), add ``--default-character-set=utf8mb4``::
5262

5363
mysqldump --single-transaction --default-character-set=utf8mb4 -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
5464

55-
To backup **MariaDB**, replace `mysqldump` with `mariadb-dump` in the above commands.
56-
5765
SQLite
5866
^^^^^^
5967
::

admin_manual/maintenance/restore.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,23 @@ Restore database
3232
The easiest way to do this is to drop and recreate the database.
3333
SQLite does this automatically.
3434

35+
MariaDB
36+
^^^^^^^
37+
38+
MariaDB is the recommended database engine. To restore MariaDB using the `mariadb <https://mariadb.com/docs/server/clients-and-utilities/mariadb-client/mariadb-command-line-client>`_ client::
39+
40+
mariadb -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
41+
mariadb -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud"
42+
43+
If you use UTF8 with multibyte support (e.g. for emojis in filenames), use::
44+
45+
mariadb -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
46+
mariadb -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
47+
3548
MySQL
3649
^^^^^
3750

38-
MySQL is the recommended database engine. To restore MySQL::
51+
To restore MySQL::
3952

4053
mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
4154
mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud"
@@ -59,10 +72,17 @@ Restoring
5972
.. note:: This guide assumes that your previous backup is called
6073
"nextcloud-sqlbkp.bak"
6174

75+
MariaDB
76+
^^^^^^^
77+
78+
MariaDB is the recommended database engine. To restore MariaDB using the `mariadb <https://mariadb.com/docs/server/clients-and-utilities/mariadb-client/mariadb-command-line-client>`_ client::
79+
80+
mariadb -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
81+
6282
MySQL
6383
^^^^^
6484

65-
MySQL is the recommended database engine. To restore MySQL::
85+
To restore MySQL::
6686

6787
mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
6888

0 commit comments

Comments
 (0)