MySQL 8.0 made utf8mb4 the default, and utf8 still lies

The character set named utf8 in MySQL has always been a three-byte subset that cannot store an emoji or several CJK characters, and 8.0 makes the four-byte one the default without renaming the old one.

-- what utf8 actually is
SHOW CHARACTER SET LIKE 'utf8%';
-- utf8    UTF-8 Unicode  utf8_general_ci    3
-- utf8mb4 UTF-8 Unicode  utf8mb4_0900_ai_ci 4

ALTER TABLE comments
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

The failure mode on the old setting is that an insert containing an emoji either errors or silently truncates the string at that character depending on strict mode, and the truncation version is the one that loses a customer’s message. Converting is a table rewrite, so it belongs in the schema-change process rather than in a casual migration. Index key lengths change too — a VARCHAR(255) unique index that fit in the old limit may not fit in the new one on older row formats.