liveBook · Manning

MySQL utf8

As explained in PostgreSQL Mistakes and How to Avoid Them

MySQL utf8 is a legacy MySQL character encoding implementation limited to Unicode characters representable in at most three bytes.

MySQL utf8 is a legacy, nonstandard UTF-8 implementation limited to three-byte characters. It cannot encode many Unicode characters or emojis; utf8mb4 was added for full four-byte support while the old name remained for compatibility. section 10.3

Migration failure

A MySQL dump imported into PostgreSQL can fail with invalid UTF8 errors. A byte such as 0xe9 may actually be Latin 1 data from tables that retained an older latin1 default, while four-byte characters expose MySQL utf8's limitation. section 10.3

Treat encoding conversion as a migration concern:

  • Identify the actual table encoding rather than trusting the server version or current default. section 10.3

How PostgreSQL Mistakes and How to Avoid Them covers it

How deep it goes
Explains the three-byte limitation, contrasts utf8mb4, and traces resulting import failures without detailing MySQL internals.
Examples
Uses international names, emojis, Latin 1 byte 0xe9, and failed PostgreSQL dump imports as concrete cases.
What you can do after
Diagnose encoding-related import failures and choose conversion or cleanup steps before retrying a migration.
How it connects
Connects MySQL utf8 with utf8mb4, latin1, Unicode, UTF-8, and PostgreSQL imports.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of PostgreSQL Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.