Skip to main content
Version: V1.4.0

SET CHARSET

Description​

This statement is used to set the character set for the client and results.

Syntax​

SET {CHARSET | CHARACTER SET} {DEFAULT | charset_name};

Parameters​

ParameterDescription
charset_nameSpecifies the character set for the client and results. Valid values are utf8mb4 and binary.
DEFAULTUses the system default character set.

Examples​

Set the client and result character sets to utf8mb4.

SET CHARSET 'utf8mb4';
Query OK, 0 rows affected

SHOW VARIABLES LIKE '%char%';
+--------------------------------------+---------+
| Variable_name | Value |
+--------------------------------------+---------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb4 |
| validate_password_special_char_count | 0 |
+--------------------------------------+---------+
8 rows in set (0.016 sec)