問題描述:
'aamkadexm2m5njq2lwuzyzctndfkmc1h',
'aamkadexm2m5njq2lwuzyzctndfkmc1h'.
原來mysql查詢時,存在不區分大小寫的情況。可以通過binary關鍵字加以解決。
解決方法有兩種:
第一種:讓mysql查詢時區分大小寫

select * from usertable where binary id='aamkadexm2m5njq2lwuzyzctndfkmc1h';
第二種:在建表時加以辨別

create table `usertable`(
`id` varchar(32) binary,
primary key (`id`)
) engine=innodb default charset=utf8;
或

create table `usertable` (
`id` varchar(32) character set utf8 collate utf8_bin not null default '',
在mysql中,存在大小寫問題的地方還有:
(1) 關鍵字: 不區分大小寫 select * from table_name 和 select * from table_name 效果是一樣的
(3) 表的别名:不區分大小寫 select m.* from users m where m.username = 'aa';
(4) 列的别名:不區分大小寫 select uname from (select username as uname from users where id = 768) ;