You can execute the SET CHARACTER SET statement to specify a character set that is used by the current client to communicate with the server. This statement sets character_set_client and character_set_results to specified values, and sets character_set_connection to the value of character_set_database.

Syntax

SET {CHARACTER SET | CHARSET}
    {'charset_name' | DEFAULT}
You do not need to enclose charset_name in single quotation marks (').

Examples

SHOW SESSION VARIABLES LIKE 'character\_set\_%';
+--------------------------+---------+
| Variable_name            | Value   |
+--------------------------+---------+
| character_set_client     | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database   | utf8    |
| character_set_filesystem | binary  |
| character_set_results    | utf8mb4 |
| character_set_server     | utf8    |
| character_set_system     | utf8    |
+--------------------------+---------+
7 rows in set (0.01 sec)

SET CHARSET 'big5';
Query OK, 0 rows affected (0.06 sec)

SHOW SESSION VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| character_set_client     | big5   |
| character_set_connection | utf8   |
| character_set_database   | utf8   |
| character_set_filesystem | binary |
| character_set_results    | big5   |
| character_set_server     | utf8   |
| character_set_system     | utf8   |
+--------------------------+--------+
7 rows in set (0.21 sec)