在MySQL中,我应该选择哪种排序规则?

时间:2022-04-09 19:18:30

When I create a new MySQL database through phpMyAdmin, I have the option to choose the collation (e.g.-default, armscii8, ascii, ... and UTF-8). The one I know is UTF-8, since I always see this in HTML source code. But what is the default collation? What are the differences between these choices, and which one should I use?

当我通过phpMyAdmin创建一个新的MySQL数据库时,我可以选择排序规则(例如-default,armscii8,ascii,...和UTF-8)。我知道的是UTF-8,因为我总是在HTML源代码中看到这一点。但是默认排序规则是什么?这些选择之间有什么区别,我应该使用哪一个?

2 个解决方案

#1


14  

Collation is not actually the default, it's giving you the default collation as the first choice.

排序规则实际上不是默认排序,它会将默认排序规则作为首选。

What we're talking about is collation, or the character set that your database will use in its text types. Your default option is usually based on regional settings, so unless you're planning to globalize, that's usually peachy-keen.

我们所讨论的是整理,或者数据库将在其文本类型中使用的字符集。您的默认选项通常基于区域设置,因此除非您计划进行全球化,否则通常是非常敏锐的。

Collations also determine case and accent sensitivity (i.e.-Is 'Big' == 'big'? With a CI, it is). Check out the MySQL list for all the options.

排序还可以确定大小写和重音敏感度(即'大'=''大'?对于CI,它是)。查看所有选项的MySQL列表。

#2


22  

Collation tells database how to perform string matching and sorting. It should match your charset.

排序规则告诉数据库如何执行字符串匹配和排序。它应该匹配你的charset。

If you use UTF-8, the collation should be utf8_general_ci. This will sort in Unicode order (case-insensitive) and it works for most languages. It also preserves ASCII and Latin1 order.

如果使用UTF-8,则排序规则应为utf8_general_ci。这将按Unicode顺序排序(不区分大小写),并且适用于大多数语言。它还保留ASCII和Latin1顺序。

The default collation is normally latin1.

默认排序规则通常是latin1。

#1


14  

Collation is not actually the default, it's giving you the default collation as the first choice.

排序规则实际上不是默认排序,它会将默认排序规则作为首选。

What we're talking about is collation, or the character set that your database will use in its text types. Your default option is usually based on regional settings, so unless you're planning to globalize, that's usually peachy-keen.

我们所讨论的是整理,或者数据库将在其文本类型中使用的字符集。您的默认选项通常基于区域设置,因此除非您计划进行全球化,否则通常是非常敏锐的。

Collations also determine case and accent sensitivity (i.e.-Is 'Big' == 'big'? With a CI, it is). Check out the MySQL list for all the options.

排序还可以确定大小写和重音敏感度(即'大'=''大'?对于CI,它是)。查看所有选项的MySQL列表。

#2


22  

Collation tells database how to perform string matching and sorting. It should match your charset.

排序规则告诉数据库如何执行字符串匹配和排序。它应该匹配你的charset。

If you use UTF-8, the collation should be utf8_general_ci. This will sort in Unicode order (case-insensitive) and it works for most languages. It also preserves ASCII and Latin1 order.

如果使用UTF-8,则排序规则应为utf8_general_ci。这将按Unicode顺序排序(不区分大小写),并且适用于大多数语言。它还保留ASCII和Latin1顺序。

The default collation is normally latin1.

默认排序规则通常是latin1。