How to enable MySQL/MariaDB 4-byte support

Hello, I use Nextcloudpi and I would like to sync my bookmarks with floccus (for Firefox).

I have a problem with the synchronization of my bookmarks with floccus (Error 500. Failed POST request) and I found a subject about this error on the floccus github web page.

The solution proposed by the developer is that rich characters (like emoji) disturb the synchronization of bookmarks and it is then necessary to modify the MySQL or MariaDB database to modify the charset to utf8mb4 by following this tutorial.

The reason I installed Nextcloudpi is that I’m not a code expert. I can try to tweak the system files but I’m afraid I’ll make mistakes. Could you tell me which database to modify (MySQL or MariaDB) and how to enable utf8mb4 safely please ?

Thank you very much for your kind help.

First of all: Create a backup before changing anything on the DB.

That done, start mysql from the command line (root account):
mysql -u root -p

Select your NC DB (here I call it “nextcloud_db”):
use nextcloud_db;

The command show variables like "character_set_database"; should output something like “latin1”, then no 4 byte support is enabled.

To change it: ALTER DATABASE nextcloud_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Another call of show variables like "character_set_database"; should now ouput “utf8mb4”

Exit the mysql command line and make the changes to the NC config:

cd /var/www/nextcloud
sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
sudo -u www-data php occ maintenance:repair

NCP already has utfmb4 enabled, no need to change anything

I use floccus/firefox myself with NCP, no problems

OK, then we need the server logs I think.

Hello, thank you all for your help !

The log file is a bit complicated to share as it contains some private links (nothing abnormal don’t worry ^^) among many many others, so it is difficult to sort them before showing it.

What is strange, is that since Firefox 64.0 update this morning, I have no more issue (it shows all good - Last synchronized : 3 mn ago). I really don’t know what happened as it is the first time I install completely floccus. The only change was Firefox update (for your information, I am on Linux).

I keep this thread open a few days, and if there is no more issue, I will close it.

EDIT : I confirm that since the new Firefox version, I have no more trouble.

I would need some help to reverse the process, because I found out, later in the game, that I can not have 4 byte support in my data base.