MySQL 數(shù)據(jù)庫中有一個數(shù)據(jù)庫叫做 information_schema 數(shù)據(jù)庫惧互,這個數(shù)據(jù)庫是用來存儲MySQL所維護的其他數(shù)據(jù)庫信息的。其中一些表在注入時候可以利用来颤。
schemata 表
提供了當前 MySQL 中所有數(shù)據(jù)庫的信息熊经,show databases 命令執(zhí)行的是 select * from information_schema.schemata 語句呕诉。
MySQL中所有數(shù)據(jù)庫.png
schemata表中的信息.png
tables 表
提供了關于數(shù)據(jù)庫中表的信息,記錄了表所屬的數(shù)據(jù)庫(schema)挑豌,表引擎等信息安券。其中 table_schema 列中存的是數(shù)據(jù)庫名,tables_name 列中存的是表名氓英。
tables表中的信息.png
columns 表
提供了表中列的信息侯勉,詳細的表述了某張表中的所有列以及列的信息,其中 table_schema 列中存儲的是數(shù)據(jù)庫名铝阐,table_name 列中存儲的是表名址貌,column_name 存儲的是列名。
columns表中存儲的信息.png
例子
查詢 security 數(shù)據(jù)庫所有的表名
select table_name from information_schema.tables where tables_schema=’security'
查詢 security 數(shù)據(jù)庫 users 表中的所有列
select column_name from information_schema.columns where tables_schema=‘users'