[英]Case Sensitive collation in MySQL
Is there any Collation type in MySQL which supports Case Sensitive. MySQL 中是否有任何支持区分大小写的排序规则类型。 I had all type of collation in MySQL they all have _ci at the end of their name so they are case Insensitive collation.
我在 MySQL 中有所有类型的排序规则,它们的名称末尾都有 _ci,因此它们是不区分大小写的排序规则。
According to MySQL Manual http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html you should be able to set collation to _cs
for case sensitivity.根据 MySQL 手册http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html,您应该能够将排序
_cs
设置为_cs
以区分大小写。 You can get a list of _cs
collations by executing SHOW COLLATION WHERE COLLATION LIKE "%_cs"
query您可以通过执行
SHOW COLLATION WHERE COLLATION LIKE "%_cs"
查询来获取_cs
排序规则列表
After a little research:经过一番研究:
Apparently there are no utf8_*_cs
in MySQL (yet).显然 MySQL 中没有
utf8_*_cs
(还)。 If you need case sensitive collation for utf8 fields, you should use utf8_bin
.如果您需要 utf8 字段区分大小写的排序规则,您应该使用
utf8_bin
。 This will mess up ORDER BY
, but this can be fixed by ORDER BY column COLLATE utf8_general_ci
这会弄乱
ORDER BY
,但这可以通过ORDER BY column COLLATE utf8_general_ci
修复
Source: http://forums.mysql.com/read.php?103,19380,200971#msg-200971 and http://forums.mysql.com/read.php?103,156527,198794#msg-198794来源: http : //forums.mysql.com/read.php?103,19380,200971#msg-200971和http://forums.mysql.com/read.php?103,156527,198794#msg-198794
尝试以_bin
结尾的排序_bin
,例如latin1_bin
或utf8_bin
,具体取决于您的字符集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.