Mediawiki: Moderation plugin error when using InnoDB and utf8mb4_unicode_ci

Today, I ran into an issue when installing the Moderation extension using InnoDB and encoding of utf8mb4_unicode_ci:

Specified key was too long; max key length is 767 bytes

The reason for this error is explained very well here, here and lots of other places. The simple and fast fix is to force the creation of the moderation table to be UTF8:

Manually remove these two tables (if you already tried to install the extension):


Then edit the extensions install sql file:

vim extensions/Moderation/sql/patch-moderation.sql

At around line 109 which will be currently ) DEFAULT /*$wgDBTableOptions*/; change this to be:

) DEFAULT CHARSET=utf8 /*$wgDBTableOptions*/;

From the command line run:

php maintenance/update.php --quick

Barring any other errors, you should now have the Moderation extension properly installed.