Fresh NC 15.0.6 Install (CentOS) - LDAP Error

Nextcloud version: 15.0.6
Operating system and version: CentOS Linux release 7.6.1810 (Core)
Apache or nginx version: Apache/2.4.6 (CentOS)
PHP version: 7.2

The issue you are facing:
I have a fresh install of NC, and the official LDAP app generates this error when I click the enable button:

An exception occurred while executing 'CREATE TABLE `oc_ldap_user_mapping` (`ldap_dn` VARCHAR(255) DEFAULT '' NOT NULL, `owncloud_name` VARCHAR(255) DEFAULT '' NOT NULL, `directory_uuid` VARCHAR(255) DEFAULT '' NOT NULL, UNIQUE INDEX ldap_dn_users (`ldap_dn`), PRIMARY KEY(`owncloud_name`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE = InnoDB ROW_FORMAT = compressed': SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

This works with a fresh install of NC 15.0.5 and MySQL collation set to utf8. Any help here would be appreciated. Thank you in advance.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Install Nextcloud on CentOS with MySQL with utf8mb4 collation.
  2. Log in as ‘admin’.
  3. Navigate to Settings -> Apps.
  4. Locate ‘LDAP user and group backend’, and click it.
  5. The message above appears both next to the LDAP app and also in the Admin > Logging.

The output of your Nextcloud log in Admin > Logging:

Error	settings	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'CREATE TABLE `oc_ldap_user_mapping` (`ldap_dn` VARCHAR(255) DEFAULT '' NOT NULL, `owncloud_name` VARCHAR(255) DEFAULT '' NOT NULL, `directory_uuid` VARCHAR(255) DEFAULT '' NOT NULL, UNIQUE INDEX ldap_dn_users (`ldap_dn`), PRIMARY KEY(`owncloud_name`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE = InnoDB ROW_FORMAT = compressed': SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'aFewLetters',
  'passwordsalt' => 'aBunchaLetters',
  'secret' => 'anotherBunchaLetters',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'nc-server.domain.tdl',
    2 => 'cloud.domain.tdl',
  ),
  'datadirectory' => '/var/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.6.1',
  'overwrite.cli.url' => 'https://cloud.domain.tdl',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'dbadmin',
  'dbpassword' => 'superSecretSaucePWone',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 3306,
    'dbindex' => 0,
    'password' => '',
    'timeout' => 1.5,
  ),
  'mysql.utf8mb4' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

access_log:10.10.10.1 - - [05/Apr/2019:13:33:40 -0500] "GET /apps/user_ldap/img/app.svg HTTP/1.1" 200 950 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"

SOLVED.

This issue only manifested itself with Nextcloud v15.0.6 and MySQL v5.x (with uft8mb4 collation). On another fresh install of Nextcloud v15.0.6 and MySQL 8.0.15 (with uft8mb4 collation), it works fine.