Parse MySQL's information_schema database

  • 2020-05-27 07:22:48
  • OfStack

The information_schema database was generated after version 5.0 of mysql, a virtual database that does not physically exist.
The information_schema database is similar to the "data dictionary" in that it provides access to the database metadata, the data of the data. Such as database or table names, column types, access rights (a more granular access).

Among the important tables are:
SCHEMATA table
-- the SCHEMATA table provides information about all the databases in the current mysql instance. Is the result of show databases taken from this table.
TABLES table
-- the TABLES table provides information (including views) about the tables in the database. Details which schema a table belongs to, table type, table engine, creation time, and so on. Is the result of show tables from schemaname taken from this table.
COLUMNS table
-- the COLUMNS table provides the column information in the table. Specifies all the columns of a table and the information for each column. Is the result of show columns from schemaname. tablename.
STATISTICS table
-- the STATISTICS table provides information about table indexes. Is the result of show index from schemaname.tablename is taken from this table.
USER_PRIVILEGES table
--USER_PRIVILEGES table gives information about full access. This information is from the mysql.user authorization form. Non-standard table.
SCHEMA_PRIVILEGES table
--SCHEMA_PRIVILEGES table gives information about schema (database) permissions. This information is from the mysql.db authorization table. Non-standard table.
TABLE_PRIVILEGES table
--TABLE_PRIVILEGES (table permissions) the table gives information about table permissions. This information is from the mysql.tables_priv authorization table. Non-standard table.
COLUMN_PRIVILEGES table
--COLUMN_PRIVILEGES table gives information about column permissions. This information is from the mysql.columns_priv authorization table. Non-standard table.
CHARACTER_SETS table
The CHARACTER_SETS (character set) table provides information about the character set available for mysql instances. Is the SHOW CHARACTER SET result set taken from this table.
COLLATIONS table
--COLLATIONS table provides the reference information for each character set.
COLLATION_CHARACTER_SET_APPLICABILITY table
--COLLATION_CHARACTER_SET_APPLICABILITY table indicates the character set that can be used for collation. These columns are equivalent to the first two display fields of SHOW COLLATION.
TABLE_CONSTRAINTS table
--TABLE_CONSTRAINTS table describes tables with constraints. And the constraint type of the table.
KEY_COLUMN_USAGE table
--KEY_COLUMN_USAGE table describes the key columns with constraints.
ROUTINES table
--ROUTINES table provides information about storage subroutines (stored programs and functions). At this point, the ROUTINES table does not contain custom functions (UDF). The column named "mysql.proc name" indicates the mysql.proc table column corresponding to the INFORMATION_SCHEMA.ROUTINES table column.
VIEWS table
--VIEWS table gives information about the views in the database. You need to have show views permissions, otherwise you cannot view the view information.
TRIGGERS table
--TRIGGERS table provides information about the trigger. You must have super permissions to view the table.
In addition, new tables will be added in future releases.

information_schema is a database that consists of metadata from a database. It stores the basic database information of mysql. And change at any time. Used to view information and act as an important information provider when making system decisions.

Related articles: