MySQL 中的排序规则
Collate Latin1_General_CS_AS 和 Collate utf8_bin 是否相同,它们是不同的,前者用于 Latin1 字符集,后者用于 utf8 字符集,但我想知道两者是否都会进行区分大小写和重音敏感的匹配。
实际上,现在我已经将数据库从 sql server2000 迁移到 MySQL 5.2,我有一个密码字段,我想与 sql server 中的区分大小写和重音敏感的字段进行比较,Collate Latin1_General_CS_AS 工作正常,但我想知道 Collate utf8_bin 是替代品对于 MySQL 来说,或者还有其他一些更好的方法可以实现相同的目的。
Whether Collate Latin1_General_CS_AS and Collate utf8_bin are same, well they are different the former is for Latin1 charset and the latter is for utf8 charset but i wanted to know whether both of will do case sensitive and Accent sensitive match.
Actually just now i have migrated my database from sql server2000 to MySQL 5.2 and i have a password field which i want to compare with case sensitive and Accent sensitive in sql server that Collate Latin1_General_CS_AS is working fine but i want to know Collate utf8_bin is the replacement for that in MySQL or there are some other better ways to achieve the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 SQL Server 和你提到的排序规则,但是 utf8_bin 是一个 二进制排序规则,确实区分大小写和重音。
不过,您不一定需要在该排序规则中包含整个数据库 - 二进制排序规则在 排序。您可以使用
COLLATE
关键字:I don't know SQL server and the collation you mention, but
utf8_bin
, being a binary collation, is indeed case and accent sensitive.You don't necessarily need to have the entire database in that collation though - binary collations are not great at sorting. You can force a binary comparison in a non-binary collation (like
utf8_general_ci
) using theCOLLATE
keyword: