Schema and performance
Use utf8mb4 for text
Store complete Unicode text and test how the chosen collation changes equality, uniqueness, and sorting in the application.
8 minute lesson
~~~
Use utf8mb4 for new MySQL applications. MySQL 8.4 keeps the historical utf8 name as a deprecated alias for the three-byte utf8mb3 character set.
A collation controls equality and sorting. utf8mb4_0900_ai_ci is accent-insensitive and case-insensitive, so a unique tag named Résumé conflicts with resume.
That behavior is often useful for names and tags. If case or accents carry meaning in your product, choose and test a different collation before storing data.
Inspect the current database settings with:
SELECT @@character_set_database, @@collation_database;Lesson completed