MySQL 数据库中有一个数据库叫做 information_schema 数据库,这个数据库是用来存储MySQL所维护的其他数据库信息的。其中一些表在注入时候可以利用。
schemata 表
提供了当前 MySQL 中所有数据库的信息,show databases 命令执行的是 select * from information_schema.schemata 语句。


tables 表
提供了关于数据库中表的信息,记录了表所属的数据库(schema),表引擎等信息。其中 table_schema 列中存的是数据库名,tables_name 列中存的是表名。

columns 表
提供了表中列的信息,详细的表述了某张表中的所有列以及列的信息,其中 table_schema 列中存储的是数据库名,table_name 列中存储的是表名,column_name 存储的是列名。

例子
查询 security 数据库所有的表名
select table_name from information_schema.tables where tables_schema=’security'
查询 security 数据库 users 表中的所有列
select column_name from information_schema.columns where tables_schema=‘users'
网友评论