Troubles with ‘mysql.utf8mb4’ => true

I just installed a brand new machine with LEMP and NC 17, so there were no old legacies lurking around.

Then I ran into several problems that are all connected to the option

‘mysql.utf8mb4’ => true

in NC’s config file:

  • when a user wants to share a file or folder, no user can be found
  • the admin does not see any user on the user setting page
  • even commands line “occ files:scan --all” fail to work

All these errors can be avoided by disabling that option.

Sure, but some Apps require it. And if you setup your DB to encode Multibyte, it seems not to be a good idea to disable it here.

MariaDB is setup to use multibyte - at least I think so:

/etc/mysql/mariadb.conf.d/50-server.cnf:

character-set-server = utf8mb4
collation-server = utf8mb4_general_ci

Still, NC tells me:

In AbstractMySQLDriver.php line 106:
                                                                                                                               
  An exception occurred while executing 'SELECT `uid`, `displayname` FROM `oc_users` `u` LEFT JOIN `oc_preferences` `p` ON (`  
  userid` = `uid`) AND (`appid` = 'settings') AND (`configkey` = 'email') WHERE (`uid`  COLLATE utf8mb4_general_ci LIKE ?) OR  
   (`displayname`  COLLATE utf8mb4_general_ci LIKE ?) OR (`configvalue`  COLLATE utf8mb4_general_ci LIKE ?) ORDER BY `uid_low  
  er` ASC' with params ["%%", "%%", "%%"]:                                                                                     
                                                                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'utf8  
  '                                                                                                                            
                                                                                                                               

In PDOStatement.php line 119:
                                                                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'utf8  
  '                                                                                                                            
                                                                                                                               

In PDOStatement.php line 117:
                                                                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'utf8  
  '

The database indeed seems not to be configured correctly. Due to the fact that this kind of problem is addressed at least once a week, it would recommend to use the search function of this forum to find an answer on how to configure it correctly.

https://help.nextcloud.com/search?q=COLLATION%20%27utf8mb4_general_ci%27%20is%20not%20valid%20for%20CHARACTER%20SET%20%27utf8

Funny: I followed all the instructions found here:

https://docs.nextcloud.com/server/13/admin_manual/configuration_database/mysql_4byte_support.html

And still I get these errors.

funny as well: why do you use the admin manual for version 13 to configuere a v17 machine?

Because I did not find find any instructions concerning 4byte support on NC 17.

By the way: the instruction still seem to be same:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/mysql_4byte_support.html

Supplementary question:

I can set

‘mysql.utf8mb4’ => false

in config.php to avoid the trouble that 4byte support seems to cause, but can I suppress the warning about mysql not supporting 4byte characters some how?