Nextcloud asking me to convert the database type

Whenever I go into the News app for Nextcloud, nextcloud pops up the following warning:

Non UTF-8 charset for MySQL/MariaDB database detected!
Learn how to convert your database to utf8mb4 (make a backup beforehand)

When I try to follow the instructions for converting though, I quickly get lost. For example:

It links to:

Reading that though it says:
“you cannot fully automate the conversion from utf8 to utf8mb4. As described in step 4 of the abovementioned guide, you’ll need to check the maximum length of columns and index keys, as the number you specify has a different meaning when utf8mb4 is used instead of utf8.”

Step 4 of the guide linked says:
"When converting from utf8 to utf8mb4, the maximum length of a column or index key is unchanged in terms of bytes. Therefore, it is smaller in terms of characters, because the maximum length of a character is now four bytes instead of three.

For example, a TINYTEXT column can hold up to 255 bytes, which correlates to 85 three-byte or 63 four-byte characters. Let’s say you have a TINYTEXT column that uses utf8 but must be able to contain more than 63 characters. Given this requirement, you can’t convert this column to utf8mb4 unless you also change the data type to a longer type such as TEXT — because if you’d try to fill it with four-byte characters, you’d only be able to enter 63 characters, but not more.

The same goes for index keys. The InnoDB storage engine has a maximum index length of 767 bytes, so for utf8 or utf8mb4 columns, you can index a maximum of 255 or 191 characters, respectively. If you currently have utf8 columns with indexes longer than 191 characters, you will need to index a smaller number of characters when using utf8mb4. (Because of this, I had to change some indexed VARCHAR(255) columns to VARCHAR(191).)"

At this point, I’m over my head. Does anyone know how I’d actually go about making the necessary conversions without breaking anything in Yunohost?

I was not in over my head, and I followed the instructions, but it turned out I was led down the garden path by that same error message. Here’s what actually needed to be done:

In your my.cnf on your mysql server, set the following (and I believe you’ll have to restart mysqld or else figure out how to set it dynamically while it’s running):
[mysqld]
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_file_per_table=ON

Then as your apache user, run (from your nextcloud directory):
occ db:convert-mysql-charset

This should start the conversion process for you.

crazy i got this the other day

@Ioan Did you try @dbenoy’s solution? How did it work out for you?

nah i wait for the update

I’m still trying to figure this out, ahh… 3.5 years later, but now it’s making a couple of my Nextcloud apps not work.

The instructions in Nextcloud server admin pages largely seem clear enough, but there’s a certain amount of stuff that’s assumed which would need to be modified specifically for Yunohost. What’s the database name? The database user name? The database password? etc.

So has anyone actually figured out how to do the UTF8 to UTF8mb4 conversion in Yunohost? I’m running Yunohost 4.0.8.3 (stable) with Nextcloud_ynh 19.0.3 which has been manually upgraded to Nextcloud 20.0.3.