MySQL中的大小写敏感整理 [英] Case Sensitive collation in MySQL

查看:446
本文介绍了MySQL中的大小写敏感整理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MySQL中有任何排序规则类型支持区分大小写。
我有MySQL的所有类型的排序规则,他们都有_ci在他们的名字的末尾,因此他们是不区分大小写。提前感谢。

Is there any Collation type in MySQL which supports Case Sensitive. I had all type of collation in MySQL they all have _ci at the end of their name so they are case Insensitive collation. Thank you in advance.

推荐答案

根据MySQL手册 http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html 您应该能够以将区分大小设置为 _cs 。您可以通过执行 SHOW COLLATION WHERE COLLATION LIKE%_cs查询

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. You can get a list of _cs collations by executing SHOW COLLATION WHERE COLLATION LIKE "%_cs" query

经过一番研究:

显然没有 utf8 _ * _ cs (在MySQL中)。如果您需要区分大小写的整理utf8字段,您应该使用 utf8_bin 。这将弄乱 ORDER BY ,但这可以通过修正ORDER BY列COLLATE utf8_general_ci

Apparently there are no utf8_*_cs in MySQL (yet). If you need case sensitive collation for utf8 fields, you should use utf8_bin. This will mess up ORDER BY, but this can be fixed by ORDER BY column COLLATE utf8_general_ci

资料来源: http:// forums.mysql.com/read.php?103,19380,200971#msg-200971 http://forums.mysql.com/read.php?103,156527,198794#msg-198794

这篇关于MySQL中的大小写敏感整理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆