How to Use the Default Collation utf8mb4_general_ci When Creating a Cluster in TiDB 6.0

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB6.0 如何在创建集群时使用默认排序规则为utf8mb4_general_ci

| username: Echo_404

[Test Environment for TiDB] Production environment in testing

[Problem Encountered:] As a beginner, I feel a bit confused after reading the documentation. How can I set the default collation to utf8mb4_general_ci when creating a cluster? How can I change the collation of an already created cluster from utf8mb4_bin to utf8mb4_general_ci?

Thanks for the help. The collation documentation is a bit challenging for me to understand :sweat_smile: (MySQL beginner)

| username: xfworld | Original post link

If the new framework’s support for characters is enabled, it can be directly supported without specific settings. However, this parameter needs to be set during cluster initialization…

Reference documentation:

Details:



| username: tidb菜鸟一只 | Original post link

You can show that the supported collations already include utf8mb4_general_ci, which means the new_collations_enabled_on_first_bootstrap parameter was set to true when initializing the cluster. So you can directly modify the parameters as follows:
SET GLOBAL collation_connection=‘utf8mb4_general_ci’;
SET GLOBAL collation_database=‘utf8mb4_general_ci’;
SET GLOBAL collation_server=‘utf8mb4_general_ci’;

| username: Echo_404 | Original post link

This makes everything clear! :heart_eyes: Thank you for the explanation.

| username: Echo_404 | Original post link

If you set it this way in the command line, will it become invalid after restarting the cluster, or will it remain effective permanently?

| username: tidb菜鸟一只 | Original post link

Long-lasting, set global changes system variables, not configuration file parameters.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.