Bug Report
SET NAMES utf8mb4 does not change collation_connection when default_collation_for_utf8mb4 is modified.
1. Minimal reproduce step (Required)
- Startup tiup playground v8.3.0
% mysql --comments --host 127.0.0.1 --port 4000 -u root
- Confirm the default value of
default_collation_for_utf8mb4
mysql> show variables like 'default_collation_for_utf8mb4';
+-------------------------------+-------------+
| Variable_name | Value |
+-------------------------------+-------------+
| default_collation_for_utf8mb4 | utf8mb4_bin |
+-------------------------------+-------------+
1 row in set (0.00 sec)
- Confirm the default value of
collation_connection
mysql> show variables like 'collation_connection';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
+----------------------+--------------------+
1 row in set (0.00 sec)
- Change the
default_collation_for_utf8mb4 value to utf8mb4_general_ci
mysql> set default_collation_for_utf8mb4 = 'utf8mb4_general_ci';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show variables like 'default_collation_for_utf8mb4';
+-------------------------------+--------------------+
| Variable_name | Value |
+-------------------------------+--------------------+
| default_collation_for_utf8mb4 | utf8mb4_general_ci |
+-------------------------------+--------------------+
1 row in set (0.00 sec)
- Execute
SET NAMES utf8mb4
mysql> SET NAMES utf8mb4;
Query OK, 0 rows affected (0.00 sec)
- Validate the
collation_connection value after default_collation_for_utf8mb4 has been modified to utf8mb4_general_ci.
mysql> show variables like 'collation_connection';
+----------------------+-------------+
| Variable_name | Value |
+----------------------+-------------+
| collation_connection | utf8mb4_bin |
+----------------------+-------------+
1 row in set (0.00 sec)
mysql>
2. What did you expect to see? (Required)
The last collation_connection value should show utf8mb4_general_ci as default_collation_for_utf8mb4 modified to utf8mb4_general_ci
3. What did you see instead (Required)
The last collation_connection value shows utf8mb4_bin.
mysql> show variables like 'default_collation_for_utf8mb4';
+-------------------------------+-------------+
| Variable_name | Value |
+-------------------------------+-------------+
| default_collation_for_utf8mb4 | utf8mb4_bin |
+-------------------------------+-------------+
1 row in set (0.00 sec)
4. What is your TiDB version? (Required)
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.3.0
Edition: Community
Git Commit Hash: 1a0c3ac3292fff7742faa0c00a662ccb66ba40db
Git Branch: HEAD
UTC Build Time: 2024-08-20 10:23:00
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
mysql>
Bug Report
SET NAMES utf8mb4does not changecollation_connectionwhendefault_collation_for_utf8mb4is modified.1. Minimal reproduce step (Required)
% mysql --comments --host 127.0.0.1 --port 4000 -u rootdefault_collation_for_utf8mb4collation_connectiondefault_collation_for_utf8mb4value toutf8mb4_general_ciSET NAMES utf8mb4collation_connectionvalue afterdefault_collation_for_utf8mb4has been modified toutf8mb4_general_ci.2. What did you expect to see? (Required)
The last
collation_connectionvalue should showutf8mb4_general_ciasdefault_collation_for_utf8mb4modified toutf8mb4_general_ci3. What did you see instead (Required)
The last
collation_connectionvalue showsutf8mb4_bin.4. What is your TiDB version? (Required)