MySQL Connection


Example

Vital to using character sets is to tell the MySQL-server what encoding the client's bytes are. Here is one way:

SET NAMES utf8mb4;

Each language (PHP, Python, Java, ...) has its own way the it usually preferable to SET NAMES.

For example: SET NAMES utf8mb4, together with a column declared CHARACTER SET latin1 -- this will convert from latin1 to utf8mb4 when INSERTing and convert back when SELECTing.