Purpose
This statement is used to set the client and result character sets.
Syntax
SET {CHARSET | CHARACTER SET} {DEFAULT | charset_name}
Parameters
Parameter |
Explanation |
|---|---|
| charset_name | Specify the client and result character sets. The following character sets are supported:
|
| DEFAULT | Use 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:
obclient> SET CHARSET DEFAULT;