kient88 发表于 2018-10-3 12:19:41

查看MySQL库中各个表记录数

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

for n in `mysql -uroot -p'12334' -e "usenovel;show tables;"|sed '1d'`;do echo $n; mysql -uroot -p'12334' -e "usenovel;select count(*) from $n;";done >test.txt  

# 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


页: [1]
查看完整版本: 查看MySQL库中各个表记录数