原因
mysql默认字段值不区分大小写,是校对规则的原因,我的是utf8_general_ci
collate规则:
*_bin: 表示的是binary case sensitive collation,也就是说是区分大小写的
*_cs: case sensitive collation,区分大小写
*_ci: case insensitive collation,不区分大小写
解决
方法一:查询时加binary
select * from table where binary name="Abc";
方法二:修改对应位置collation规则
建表
create table `table`(
`id` varchar(32) binary,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
或
create table `table`(
`id` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
或者
修改该字段的COLLATE为utf8_bin