Description:
Description:
When you log in to the MySQL client and execute the command "set global character_set_client=xxx", and then exit the current session and log in again, you will see that the variable values at the session level and the global level are different.
How to repeat:
1. Create a MySQL instance with version 8.2.0
2. log in MySQL client, view the value of the "character_set_client"
mysql> 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 | utf8mb3 |
| character_sets_dir | /opt/mysql/base/8.2.0/share/charsets/ |
+--------------------------+---------------------------------------+
8 rows in set (0.01 sec)
mysql> show global 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 | utf8mb3 |
| character_sets_dir | /opt/mysql/base/8.2.0/share/charsets/ |
+--------------------------+---------------------------------------+
3.Execute setting global character_set_client=utf8mb3,then exit the current session
mysql> set global character_set_client=utf8mb3;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit
5.Log in again,view the value of the "character_set_client"
mysql> 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 | utf8mb3 |
| character_sets_dir | /opt/mysql/base/8.2.0/share/charsets/ |
+--------------------------+---------------------------------------+
8 rows in set (0.01 sec)
mysql> show global variables like "%char%";
+--------------------------+---------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------+
| character_set_client | utf8mb3 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb3 |
| character_sets_dir | /opt/mysql/base/8.2.0/share/charsets/ |
+--------------------------+---------------------------------------+
more ,I also make a test for "set global character_set_connection=utfmb3" and "set global character_set_results=utfmb3",find the same problem.