当我测试下面的SQL查询时:
1. SELECT * FROM table WHERE username='username' AND password = 'password';
2. SELECT * FROM table WHERE username='Username' AND password = 'Password';
即使用户名和密码区分大小写,
也会返回相同的结果
答案 0 :(得分:3)
使用此查询
SELECT * FROM table WHERE username='Username' AND binary password = 'Password';
答案 1 :(得分:3)
区分大小写查询的语法
SELECT * FROM `table` WHERE BINARY `column` = 'value'
在你的情况下,它将成为:
SELECT * FROM table WHERE BINARY username='Username' AND BINARY password = 'Password';