-- 创建表: CREATE TABLE testt( id INT PRIMARY KEY, name VARCHAR(32) NOT NULL ) ENGINE = INNODB COLLATE =utf8_bin; -- 修改表结构的Collation属性 ALTER TABLE TABLENAME MODIFY COLUMN COLUMNNAME VARCHAR(50) BINARY CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL;
-- 在每一个条件前加上binary关键字 select * from user where binary username = 'admin' and binary password = 'admin'; -- 将参数以binary('')包围 select * from user where username like binary('admin') and password like binary('admin');