码迷,mamicode.com
首页 > 数据库 > 详细

查看MySQL库中各个表记录数

时间:2018-05-24 18:55:22      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:查看MySQL库中各个表记录数

说明,此方法只适合数据库库中表的记录数是较小的情况下,线上可以考虑采用,要是数据库的表特别的大的话,就不要采用此方法了,负责会导致mysql的服务器的负载特别的高,有可能导致服务器被挂掉的风险。

for n in `mysql -uroot -p‘12334‘ -e "use  novel;show tables;"|sed ‘1d‘`;do echo $n; mysql -uroot -p‘12334‘ -e "use  novel;select count(*) from $n;";done >test.txt
[root@git-server ~]# cat test11.txt 
fpagent
count(*)
1
fpagentprop
count(*)
0
fpagentsession
count(*)
0
fpchatsetting
count(*)
51
fpdispatcher
count(*)
1
fpdispatcherprop
count(*)
0
fpofflinesetting
count(*)
0
fpqueue
count(*)
1
fpqueueagent
count(*)
1
fpqueuegroup
count(*)
0

查看MySQL库中各个表记录数

标签:查看MySQL库中各个表记录数

原文地址:http://blog.51cto.com/wujianwei/2119979

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!