Issue
- Using Liferay 7.0 with MySQL 5.6 with collation CHARACTER SET utf8mb3 has certain limitations.
Environment
- Liferay 7.0
Resolution
-
By default, Liferay creates database tables in MySQL 5.6 with utf8mb3 (limited to only characters that have at most 3 bytes in your UTF-8 representation), and the character shared requires a 4-byte representation in UTF-8. As a result, each individual table in your MySQL 5.6 databasemustbe in utf8mb4 if you wish to allow for your content creators to create content using characters that have a 4-byte UTF-8 representation.
-
The reason it is not reproduceable in MySQL 5.7 is that Liferay does not know how to properlycreatetables with utf8mb4 on MySQL 5.6, as noted inLPS-70734. Even if the default character set on the database is utf8mb4, MySQL 5.6 doesn't honor that for table creation (you have to explicitly set it, and Liferay does not do so in its creation statements, instead assuming that the database will take care of it).
-
In addition to table creation issues, in order to avoid index creation errors, you also have to make sure that MySQL is not using Antelope (the default InnoDB file format in MySQL 5.6) and instead use Barracuda (the default InnoDB file format in MySQL 5.7 and also an option for MySQL 5.6). This is also noted inLPS-70734.
- Our recommendation is to use character set UTF-8.
Additional Information