version() –MySql版本
user() –数据库用户名
current_user() –当前用户名
session_user() –链接数据库的用户名
database() –数据库名
@@version –数据库版本
@@datadir –数据库路径
@@version_compile_os –操作系统版本
@@basedir –Mysql安装路径

字符串链接函数:
concat、concat_ws、group_concat
select concat(name,’|’,email,’|’,password) from users;将name,email,password拼接到一起,中间不能有NULL值,有的化返回空
select concat_ws(‘|’,name,email,password) from users;和上面结果相同,可以中间出现NULL值,但是第一个不能为空,不然返回空
select group_concat(username) from users;缺陷,长度为1024
组合使用:
select group_concat(concat_ws(‘|’,username,is)) from users;

字符串截取函数:limit下标从0开始
substr(substring)、mid、left、right、locate下标从1开始
substring(待查数据,开始位置,截取长度);
select substring((select username from users limit 0,1),1,2);
select mid(‘test123’,2,3);从第二个位置开始,长度为3
select left(‘test123’,3);从左边开始截取长度为3
select right(‘test123’,3);从右边开始截取长度为3
select locate(‘123test123′,’zfdsfasd123test123’);返回左边字符串在右边字符串第一次出现的位置,读取文件用方便

返回指定的ASCII字符所对应的数值
ascii、ord
select ascii(‘a’);返回字符ascii值
select ascii (substring((select username from users limit 0,1),2,1);
select ord(‘a’);效果和ascii相同

返回指定数字对应的ascii码字符
char
select char(97);返回字符a

字符串替换
replace
select replace((select username from users limit 0,1),’666′,’hh’);将查询出来的666字符串替换成hh

计算相关
length、count
select length(‘sdfsdaf’);返回出字符串长度
select count(*) from users;计算数目

时间盲注会用到的函数
benchmark(次数,语句)、sleep、if
select * from users union select 1,2,sleep(10);延时10秒

读写文件函数
into outfile、into dumpfile、load_file(‘filemname’)
select “” into outfile “d:/sehll.php”;将一句话木马写入D盘
select load_file(‘d:/shell.php’);读取文件内容