Mysql-元数据操作

记录几个MySql元数据操作的语句,以备后用

安装好mysql之后在实例下默认会有:mysql information_schema performation_schema

  • mysql 配置信息 用户信息 慢日志 server信息
  • information_schema 记录全局 database、table、column 、视图、触发器、事物元数据相关信息
  • performation_schema

操作元数据

# 查看全局 schema
select * from information_schema.SCHEMATA;

# 查看具体 schema 
select * from information_schema.SCHEMATA t where t.`SCHEMA_NAME` = 'risk_management'

# 查看全局 视图
select * from information_schema.VIEWS;

#查看具体某个schema下views
select * from information_schema.VIEWS t where t.`TABLE_SCHEMA` = 'account'

# 查看当前实例全局 table
select * from  information_schema.TABLES;

# 查看具体 table_schema 表信息 行数,数据大小,索引大小,自增最大值,表常见时间
select * from information_schema.TABLES t where t.`TABLE_SCHEMA` = 'risk_management'  and  t.`TABLE_NAME` = 'gps_info';

# 查看 database 下 table 中列名,列备注,列类型,是否为空,编码类型,是否主键,等信息
select * from `information_schema`.`COLUMNS` t where t.`TABLE_SCHEMA`='risk_management' and t.`TABLE_NAME` = 'gps_info';

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值