这里的问题是使sql查询不检查大小写敏感的后者 SQL版本;
VERSION(): 8.0.15
登录用户的Sql查询:
SELECT COUNT(*) as cnt FROM accounts WHERE (number = 'AdMin' OR email = 'AdMin') AND password = '******' AND type IN (1) AND deleted = 0
数据库存储名称='admin'
此处如何为mysql 8.0设置区分大小写的sql查询并在用户名='AdMin'时停止登录
答案 0 :(得分:2)
您需要使用BINARY
运算符使您的搜索区分大小写:
SELECT COUNT(*) as cnt
FROM accounts
WHERE (number = BINARY 'AdMin' OR email = BINARY 'AdMin') AND password = '******' AND type IN (1) AND deleted = 0