Bug #104066 Inconsistency of description for default_collation_for_utf8mb4
Submitted: 21 Jun 2021 7:00 Modified: 21 Jun 2021 8:03
Reporter: Erin Yoon Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:8.0.23, 8.0.25 OS:Linux
Assigned to: CPU Architecture:Any
Tags: collation, document, MySQL, utf8mb4

[21 Jun 2021 7:00] Erin Yoon
Description:
Hello,
I'm confused about inconsistency of description of default_collation_for_utf8mb4 between documentation and mysql.

According to server-system variables reference(https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_collat...) , 
setting the session value of this system variable is no longer a restricted operation since MySQL 8.0.18.

But when I executed a statement to set this variable, the warning message says:

+---------+------+--------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                |
+---------+------+--------------------------------------------------------------------------------------------------------+
| Warning | 1681 | Updating 'default_collation_for_utf8mb4' is deprecated. It will be made read-only in a future release. |
+---------+------+--------------------------------------------------------------------------------------------------------+

How to repeat:
mysql> set default_collation_for_utf8mb4=utf8mb4_general_ci;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                |
+---------+------+--------------------------------------------------------------------------------------------------------+
| Warning | 1681 | Updating 'default_collation_for_utf8mb4' is deprecated. It will be made read-only in a future release. |
+---------+------+--------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Suggested fix:

I don't know this is a bug or documentation error, but I think it's needed to correct either.
[21 Jun 2021 8:03] MySQL Verification Team
Hello Erin Yoon,

Thank you for the report and feedback.

regards,
Umesh
[24 Nov 2023 13:22] Snehal Bhavsar
Hello MySQL Team, 

This warning is still there in MySQL 8.0.35. We checked the official  documentation of MySQL for this variable and the details of deprecation is not mentioned on it. Could you please clarify on this part?

machine1 ~ %mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.35 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@default_collation_for_utf8mb4;
+---------------------------------+
| @@default_collation_for_utf8mb4 |
+---------------------------------+
| utf8mb4_0900_ai_ci              |
+---------------------------------+
1 row in set (0.00 sec)

mysql> 
mysql> SET PERSIST default_collation_for_utf8mb4='utf8mb4_general_ci';
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                |
+---------+------+--------------------------------------------------------------------------------------------------------+
| Warning | 1681 | Updating 'default_collation_for_utf8mb4' is deprecated. It will be made read-only in a future release. |
+---------+------+--------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> show variables like "default_collation_for_utf8mb4";
+-------------------------------+--------------------+
| Variable_name                 | Value              |
+-------------------------------+--------------------+
| default_collation_for_utf8mb4 | utf8mb4_0900_ai_ci |
+-------------------------------+--------------------+
1 row in set (0.02 sec)

mysql> ^DBye
machine1 ~ %mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.35 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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)