解决MySQL查询不区分大小写

需要设置collate(校对) 。 collate规则:
*_bin: 表示的是binary case sensitive collation,也就是说是区分大小写的
*_cs: case sensitive collation,区分大小写
*_ci: case insensitive collation,不区分大小写

如果表已经设置为不区分大小写,采用如下方式:

可以将查询条件用binary()括起来。  如:
select  *  from table  where  field = binary(‘usename’);

posted on 2014-11-18 12:56  Jacky Yu  阅读(143)  评论(0编辑  收藏  举报