mysql元数据库数据库
information_schema
保存数据库的数据库名,表名,字段名
在information_schema下:
-
schemata表,提供了当前mysql实例中所有数据库的信息。
-
tables表(所有数据库中所有表的名字),其中字段:table_name(表的名字)和table_schema(记录这张表所属的数据库名字)
-
cloumns表(存储所有字段的名字),其中字段colunm_name(存储字段名)和table_name(记录字段所属的表名)和table_schema(记录字段所属的数据库名字)
关于information_schema:
-
获取表名
union select table_schema,table_name from information_schema.tables where table_schema=database(); -
获取字段名
union select table_name,colunm_name from information_schema.clounms where table_name=‘users’;