连接Mysql数据库连接成功后,找到数据库information_schema,新建查询,运行一下脚本:
SELECT table_schema 数据库名,table_name 表名,column_name 字段名, column_type 字段类型,is_nullable 是否可空,column_default 默认值,
CASE WHEN column_key='PRI' THEN '主键'
WHEN column_key='MUL' THEN '普通索引' ELSE '无' END 索引信息,
column_comment 注释
FROM information_schema.COLUMNS
WHERE table_schema NOT IN ('mysql','information_schema','performance_schema')
ORDER BY table_name
运行成功如下图:
开始运行即可,完成后打开excel,稍微补充完善下就可以了。