Purpose
The SET CHARSET statement specifies the character set for the client and results.
Syntax
SET {CHARSET | CHARACTER SET} {DEFAULT | charset_name}
Parameters
| Parameter | Description |
|---|---|
| charset_name | Specifies the character set for the client and results. Valid values:
|
| DEFAULT | Uses the system default character set. |
Examples
Set the client character set to gbk:
obclient> SET CHARSET 'gbk';
View character set-related variables:
obclient> SHOW VARIABLES LIKE '%char%';
The query result is as follows:
+--------------------------------------+---------+
| Variable_name | Value |
+--------------------------------------+---------+
| character_set_client | gbk |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb4 |
| validate_password_special_char_count | 0 |
+--------------------------------------+---------+
8 rows in set
Set the character set to the system default value:
obclient> SET CHARSET DEFAULT;
