What is the right way to dump the database regarding character and collation?


Nextcloud version : 17.0.2
Operating system and version : Debian 10
Apache or nginx version : Apache/2.4.38 (Debian)
PHP version : PHP 7.3.9
Mariadb 10.3.17

I want to make a dump of the database but I’m a little bit confused with utf8mb4 stuff.

I want to be sure that this dump can be restored without problems if needed.

Here is what my database looks like :

MariaB [(none)]> USE nextcloud
MariaDB [nextcloud]> SELECT @@character_set_database, @@collation_database;
| @@character_set_database | @@collation_database |
| utf8mb4                  | utf8mb4_bin          |
1 row in set (0.000 sec)

In this case what is the appropriate command ?

mysqldump --single-transaction nextcloud > nextcloud.sql


mysqldump  --default-character-set=utf8mb4 --single-transaction nextcloud > nextcloud.sql

Thanks for your help