MySQL 9.7 Reference Manual Including MySQL NDB Cluster 9.7

12.15 Character Set Configuration

The MySQL server has a compiled-in default character set and collation. To change these defaults, use the --character-set-server and --collation-server options when you start the server. See Section 7.1.7, “Server Command Options”. The collation must be a legal collation for the default character set. To determine which collations are available for each character set, use the SHOW COLLATION statement or query the INFORMATION_SCHEMA COLLATIONS table.

If you try to use a character set that is not compiled into your binary, you might run into the following problems:

You can force client programs to use specific character set as follows:

[client]
default-character-set=charset_name

For MySQL client programs, specifying default-character-set=utf8 in an option file, or using the equivalent --default-character-set=utf8 command-line option, always selects utf8mb3. The server's INTERPRET_UTF8_AS_UTF8MB4 SQL mode does not affect client character set option processing. Specify utf8mb4 explicitly to use four-byte UTF-8.

This is normally unnecessary. However, when character_set_system differs from character_set_server or character_set_client, and you input characters manually (as database object identifiers, column values, or both), these may be displayed incorrectly in output from the client or the output itself may be formatted incorrectly. In such cases, starting the mysql client with --default-character-set=system_character_set—that is, setting the client character set to match the system character set—should fix the problem.