当前位置:   article > 正文

Mysql查看表的元数据信息

Mysql查看表的元数据信息

1.查看表的创建时间和更新时间

SELECT *  FROM `information_schema`.`TABLES` WHERE `information_schema`.`TABLES`.`TABLE_SCHEMA` = 'XXX' AND `information_schema`.`TABLES`.`TABLE_NAME` = 'XXX'\G
  • 1

2.查看正在运行的进程

SELECT * FROM information_schema.PROCESSLIST p where (p.INFO is not NULL or p.COMMAND='Query') AND USER='hadoop';

show processlist;
  • 1
  • 2
  • 3

3.统计MySQL中指定数据库中有多少张表

SELECT count(*) TABLES, table_schema FROM information_schema.TABLES
where table_schema = '数据库名称xxx' GROUP BY table_schema;
  • 1
  • 2

4.统计MySQL中指定数据库中表记录数

use information_schema;
select table_name,table_rows from tables where TABLE_SCHEMA = '数据库名称xxx' order by table_rows desc;

where table_schema = '你的数据库名'
  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/559784
推荐阅读
相关标签
  

闽ICP备14008679号