[SOLVED] MySQL COLLATE issue with CHARACTER SET utf8mb4 in 5.10.0

Summary

Upgrading from 5.8.0 to 5.10.0 creates the new bots table with COLLATE utf8mb4_general_ci

Steps to reproduce

Upgrade from 5.8.0 or earlier to 5.10.0 and start mattermostd. This creates the new bots table with COLLATE utf8mb4_general_ci and then writes an error in the log that utf8mb4_unicode_ci and utf8mb4_general_ci are not compatible for =.

Expected behavior

mattermostd should honor the preference set by the admin via system variables:

collation_connection = utf8mb4_unicode_ci
collation_database = utf8mb4_unicode_ci
collation_server = utf8mb4_unicode_ci

Given the above collation settings, this fixes the issue allowing mattermostd 5.10.0 to startup again:

ALTER TABLE bots CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;