存储过程 collation_connection 是 utf8mb4_general_ci 而不是 utf8mb4_unicode_ci 使用 Hiedisql mysql

Stored Procedure collation_connection is utf8mb4_general_ci instead of utf8mb4_unicode_ci using Hiedisql mysql

我正在使用 Hiedisql V9.2。

我设置默认服务器 character-set is utfmb4collation is utf8mb4_unicode_ci 但在创建存储过程后仍然显示 collation_connection =utf8mb4_general_ci.

以下是服务器 my.ini 设置。

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
init_connect                   = 'SET NAMES utf8mb4'
collation-server = utf8mb4_unicode_ci
character-set-server=utf8mb4

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

+--------------------------+--------------------+
| 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     | utf8               |
| collation_connection     | utf8mb4_unicode_ci |
| collation_database       | utf8mb4_unicode_ci |
| collation_server         | utf8mb4_unicode_ci |
+--------------------------+--------------------+

创建存储过程后仍然显示collation_connection=utf8mb4_general_ci

SHOW PROCEDURE STATUS where name LIKE 'ProcName'

+----------+----------------------+----------------------+--------------------+
| Name     | character_set_client | collation_connection | Database Collation |
+----------+----------------------+----------------------+--------------------+
| ProcName | utf8mb4              | utf8mb4_general_ci   | utf8mb4_unicode_ci |
+----------+----------------------+----------------------+--------------------+

那么,如何解决 collation_connection=utf8mb4_general_ci 问题。

我要collation_connection=utf8mb4_unicode_ci.

终于有问题了。 这是我正在使用的 Hiedisql 工具的问题。 Hiedisql 工具集 collation_connection=utf8mb4_general_ci before 运行 script.

如何修复:

只需在 运行 任何脚本之前设置以下变量值。

SET collation_connection = @@collation_database;

SET collation_connection = 'utf8mb4_unicode_ci';

注意:如果您想知道什么是实际排序规则,请使用 mysql command prompt 它将 return 实际结果。