查询information_schema

-- 统计各库的表数量:是否有漏表
MySQL [information_schema]> select  TABLE_SCHEMA ,count(1) from tables group by TABLE_SCHEMA ;
+--------------------+----------+
| TABLE_SCHEMA       | count(1) |
+--------------------+----------+
| test2              |       16 |
| test1              |      145 |

-- 统计各表的数据条数:是否有数据
MySQL [information_schema]> select TABLE_SCHEMA, table_name,table_rows from information_schema.tables where TABLE_SCHEMA in ('test1','test2') order by table_rows desc;
+--------------+------------------------------+------------+
| TABLE_SCHEMA | table_name                   | table_rows |
+--------------+------------------------------+------------+
| test1         | alertlog                     |     110115 |
| test2         | tbl_task                     |       8713 |
| test1         | appsearc					   |       2280 |
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐