In the latest
documentation (16.1.0) [1] under "MySQL database" section, it is still giving the example of MySQL 5.5 as why
utf8 (
utf8mb3) character set should be used as default and
utf8mb4 would not work for Keycloak due to "different storage requirement". Rolling forward now to MySQL 8, are there any new guidances on whether
utf8mb4 can work with Keycloak?
I did a test-run of a vanilla Keycloak 16.1.0 over a MySQL schema with utf8mb4/utf8mb4_unicode_ci, the tables were created. All tables inherited the utf8mb4/utf8mb4_unicode_ci from the schema, except for 18 columns that remain explicitly utf8/utf8_general_ci. The service appeared to be starting up fine.
I also have a Keycloak database that was created in MySQL 5.x and utf8 but has since been upgraded to MySQL 8. I have run a script to convert all tables and columns from utf8 to utf8mb4. Keycloak appears to be running fine so far.
Does anyone else have success or issues with Keycloak on MySQL 8 utf8mb4, especially during upgrades? And should the official documentation/guidance be updated to reflect the use of utf8mb4 if the "different storage requirement" in the documentation might no longer be an issue in MySQL 8?
On a side note, MySQL has said that utf8 will become alias to utf8mb3 in upcoming 8.0.28 but is "expected subsequently to become a reference to utf8mb4" [2]. Not sure if that has any impact on new Keycloak databases in some distant future if some columns are fixed to utf8.