如何选择准确的用户名和密码注意大写和小写字母 - mysql [英] How to select exactly username and password paying attention uppercase and lowercase letters - mysql

查看:127
本文介绍了如何选择准确的用户名和密码注意大写和小写字母 - mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这种情况下,我创建了登录表:



 + -------- + --- ----------- + --------- + ----- + 
| ID_LOGIN | USERNAME |密码|
+ -------- + -------------- + --------- + ----- +
| 1 |管理员|管理员|
+ -------- + -------------- + --------------- +
| 2 | MaxiKIng1991 | #$ MaxiKIng1991 |
+ -------- + -------------- + --------------- +





我要选择所有指定用户名和密码的地方。但我希望注意大写和小写字母。所以请看一下。首先我选择了第一次登录(用户名和密码)。



 SELECT * FROM`logins` WHERE USERNAME =AdMinAND PASSWORD =AdMin ; 





当我写这个查询时它显示如下:



 + -------- + -------------- + --------- + ----- + 
| ID_LOGIN | USERNAME |密码|
+ -------- + -------------- + --------- + ----- +
| 1 |管理员|管理员|
+ -------- + -------------- + --------------- +





但在我看来,它不应该显示结果。我注意到sql查询检查每个列名中有多少个字符串。当我1个字母太多或太少而没有显示任何内容。



在第二个查询案例中:



 SELECT * FROM`logins` WHERE USERNAME =Maxiking1991AND PASSWORD =#maxiking1991 $; 



然后显示如下结果:



 +   -    ------ + -------------- + --------- + ----- +  
| ID_LOGIN | USERNAME |密码|
+ - ------ + ------------ - + --------- + ----- +
| 2 | MaxiKIng1991 |#MaxiKIng1991 $ |
+ - ------ + ------------ - + --------------- +





但它不应该'也显示了这一点。



是否可以关注mysql查询中值的小写和大写字母?有任何想法吗?我很难在其上搜索任何解决方案。感谢您的帮助和建议。



我的尝试:



我已尝试过我在该问题中描述的查询:



 SELECT * FROM`logins` WHERE USERNAME =AdMinAND PASSWORD =AdMin; 





 SELECT * FROM`logins` WHERE USERNAME =Maxiking1991AND PASSWORD =#maxiking1991 $; 





但它们没有用。

解决方案
|
+ -------- + -------------- + --------------- +





我要选择所有指定用户名和密码的地方。但我希望注意大写和小写字母。所以请看一下。首先我选择了第一次登录(用户名和密码)。



 SELECT * FROM`logins` WHERE USERNAME =AdMinAND PASSWORD =AdMin ; 





当我写这个查询时它显示如下:



 + -------- + -------------- + --------- + ----- + 
| ID_LOGIN | USERNAME |密码|
+ -------- + -------------- + --------- + ----- +
| 1 |管理员|管理员|
+ -------- + -------------- + --------------- +





但在我看来,它不应该显示结果。我注意到sql查询检查每个列名中有多少个字符串。当我1个字母太多或太少而没有显示任何内容。



在第二个查询案例中:



 SELECT * FROM`logins` WHERE USERNAME =Maxiking1991AND PASSWORD =#maxiking1991 


;



然后显示以下结果:



 +   -    ------ + -------------- + --------- + ----- +  
| ID_LOGIN | USERNAME |密码|
+ - ------ + ------------ - + --------- + ----- +
| 2 | MaxiKIng1991 |#MaxiKIng1991


|
+ - ------ + ------------ - + --------------- +





但它不应该'也显示了这一点。



是否可以关注mysql查询中值的小写和大写字母?有任何想法吗?我很难在其上搜索任何解决方案。感谢您的帮助和建议。



我的尝试:



我已尝试过我在该问题中描述的查询:



 SELECT * FROM`logins` WHERE USERNAME =AdMinAND PASSWORD =AdMin; 





 SELECT * FROM`logins` WHERE USERNAME =Maxiking1991AND PASSWORD =#maxiking1991 


In this case i've created "logins" table:

+--------+--------------+---------+-----+
|ID_LOGIN| USERNAME     | PASSWORD      |
+--------+--------------+---------+-----+
| 1      | admin        | admin         | 
+--------+--------------+---------------+
| 2      | MaxiKIng1991 | #MaxiKIng1991$|
+--------+--------------+---------------+



I'm going to select all where username and password is specified. But i'd like pay attention to uppercase and lowercase letters. So please take a look. First i selected first login (username and password).

SELECT * FROM `logins` WHERE USERNAME = "AdMin" AND PASSWORD = "AdMin";



When i wrote this query it shows like this:

+--------+--------------+---------+-----+
|ID_LOGIN| USERNAME     | PASSWORD      |
+--------+--------------+---------+-----+
| 1      | admin        | admin         | 
+--------+--------------+---------------+



But in my opinion it shouldn't show the result. I noticed that sql query checks how many strings are in every column name. When i 1 letter too much or too less then shows nothing.

In that second query case:

SELECT * FROM `logins` WHERE USERNAME = "Maxiking1991" AND PASSWORD = "#maxiking1991$";


Then show below result:

+--------+--------------+---------+-----+
|ID_LOGIN| USERNAME     | PASSWORD      |
+--------+--------------+---------+-----+
| 2      |MaxiKIng1991  |#MaxiKIng1991$ | 
+--------+--------------+---------------+



But it shouldn't show that too.

Is that possible to pay attention to lowercase and uppercase letters in values in that mysql queries? any ideas? I have difficulty to search any solution on it. Thx for any help and advice.

What I have tried:

I've tried with that queries which i described in that problem:

SELECT * FROM `logins` WHERE USERNAME = "AdMin" AND PASSWORD = "AdMin";



SELECT * FROM `logins` WHERE USERNAME = "Maxiking1991" AND PASSWORD = "#maxiking1991$";



But they didn't work.

解决方案

| +--------+--------------+---------------+



I'm going to select all where username and password is specified. But i'd like pay attention to uppercase and lowercase letters. So please take a look. First i selected first login (username and password).

SELECT * FROM `logins` WHERE USERNAME = "AdMin" AND PASSWORD = "AdMin";



When i wrote this query it shows like this:

+--------+--------------+---------+-----+
|ID_LOGIN| USERNAME     | PASSWORD      |
+--------+--------------+---------+-----+
| 1      | admin        | admin         | 
+--------+--------------+---------------+



But in my opinion it shouldn't show the result. I noticed that sql query checks how many strings are in every column name. When i 1 letter too much or too less then shows nothing.

In that second query case:

SELECT * FROM `logins` WHERE USERNAME = "Maxiking1991" AND PASSWORD = "#maxiking1991


";


Then show below result:

+--------+--------------+---------+-----+
|ID_LOGIN| USERNAME     | PASSWORD      |
+--------+--------------+---------+-----+
| 2      |MaxiKIng1991  |#MaxiKIng1991


| +--------+--------------+---------------+



But it shouldn't show that too.

Is that possible to pay attention to lowercase and uppercase letters in values in that mysql queries? any ideas? I have difficulty to search any solution on it. Thx for any help and advice.

What I have tried:

I've tried with that queries which i described in that problem:

SELECT * FROM `logins` WHERE USERNAME = "AdMin" AND PASSWORD = "AdMin";



SELECT * FROM `logins` WHERE USERNAME = "Maxiking1991" AND PASSWORD = "#maxiking1991


这篇关于如何选择准确的用户名和密码注意大写和小写字母 - mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆