← Blog

Nextcloud Enable MySQL 4-byte support

1 minEN

Nextcloud Enable MySQL 4-byte support

Hi Everybody,
first of all I wish you a fantastic start for 2022 .
I want to write you about something that gave me headache for a couple of hours.
Basically after upgrading NextCloud on the Overview you might find out a warning requiring to enable the MySQL 4-byte support on your DB.
What you have to do is following the guide step by step here:
If you receive any error on the NextCloud log like:

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'utf8mb3'


you might check the collation of the NextCloud DB. It should be "utf8mb4_bin"

Nextcloud Enable MySQL 4-byte support

If not please re run these commands:
This as a SQL:

ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

This as a PHP command on your NextCloud instance

php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
php occ maintenance:repair

See you next time.