在 AWS RDS 上将 MySQL 服务器变量 collat​​ion_connection 设置为 utf8_unicode_ci

2024-03-06

所以我的目标是将所有字符集和排序规则设置为utf8 and utf8_unicode_ci.

我使用 AWS RDS 来托管 MySQL 服务器。

Ive set the collation_connection variable to utf8_unicode_ci in the Parameter group for the RDS. This is how I set the variable in the parameter group .

然后我重新启动了 RDS,当进入 MySQL 控制台时,它显示了以下变量值。

mysql> show variables like "%character%";show variables like "%collation%";
+--------------------------+-------------------------------------------+
| Variable_name            | Value                                     |
+--------------------------+-------------------------------------------+
| character_set_client     | utf8                                      |
| character_set_connection | utf8                                      |
| character_set_database   | utf8                                      |
| character_set_filesystem | binary                                    |
| character_set_results    | utf8                                      |
| character_set_server     | utf8                                      |
| character_set_system     | utf8                                      |
| character_sets_dir       | /rdsdbbin/mysql-5.6.22.R1/share/charsets/ |
+--------------------------+-------------------------------------------+
8 rows in set (0.01 sec)

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+

我不确定为什么collation_connection被设置为utf8_general_ci


您在此处看到的变量是当前客户端会话的变量:

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+

因此,当您启动连接时,您需要在要连接的客户端上运行以下命令:

SET collation_connection = 'utf8_unicode_ci';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 AWS RDS 上将 MySQL 服务器变量 collat​​ion_connection 设置为 utf8_unicode_ci 的相关文章

随机推荐