#获取字段信息(库名、表名、字段名、字段类型、主键标识、字段备注)
select
table_schema,
table_name,
column_name,
column_type,
column_key,
column_comment
from information_schema.COLUMNS
where
`table_schema`
NOT IN (
'mysql',
'performance_schema',
'sys',
'information_schema'
);
#获取表信息(库名、表名、表备注)
select
table_schema,
table_name,
table_comment
from information_schema.TABLES
where
`table_schema`
NOT IN (
'mysql',
'performance_schema',
'sys',
'information_schema'
);
#获取数据库名
select
schema_name
from information_schema.SCHEMATA
where
`schema_name`
NOT IN (
'mysql',
'performance_schema',
'sys',
'information_schema'
);
【Mysql】获取数据库相关信息
于 2021-10-22 22:22:04 首次发布