MySQL数据库中统计一个库中的所有表的行数?

今天公司两个远端的数据库主从同步有点问题,查看下wordpress库下所有表的表的条目?

mysql> use information_schema;
Database changed
mysql> select table_name,table_rows from tables where TABLE_SCHEMA = 'wordpress'order by table_rows desc;
+-----------------------+------------+
| table_name | table_rows |
+-----------------------+------------+
| wp_options | 130 |
| wp_usermeta | 18 |
| wp_posts | 4 |
| wp_postmeta | 2 |
| wp_links | 0 |
| wp_comments | 0 |
| wp_users | 0 |
| wp_commentmeta | 0 |
| wp_terms | 0 |
| wp_termmeta | 0 |
| wp_term_taxonomy | 0 |
| wp_term_relationships | 0 |
+-----------------------+------------+
12 rows in set (0.00 sec)

 

 

作者:Cherry_梅 出处:http://www.cnblogs.com/itqingtian/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/itqingtian/p/9842958.html