MySQL数据库可以利用information_schema库中的columns表快速导出数据字典。
执行以SQL语句即可对数据字典进行查询:
SELECT
TABLE_SCHEMA AS '数据库名',
TABLE_NAME AS '表名',
COLUMN_NAME AS '列名',
COLUMN_TYPE AS '类型',
COLUMN_DEFAULT AS '默认值',
IS_NULLABLE AS '允许为空',
DATA_TYPE AS '数据类型',
CHARACTER_MAXIMUM_LENGTH AS '字符**长度',
NUMERIC_PRECISION AS '数字精度',
NUMERIC_SCALE AS '小数位数',
COLUMN_COMMENT AS '字段说明'
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = 'db_name'