mysql/gbase数据库全库库表记录数统计
作者:互联网
file:mysql_rows.sh
运行:sh mysql_rows.sh 库名
脚本内容:
#!/bin/bash
user=...
pwd=...
ip=...
port=...
tb_name=`mysql -u $user -p$pwd -h$ip -P$port -e "select table_name from information_schema.tables where table_schema=$1" |awk 'NR>1{print $1}'`
>/date/$1.log
for name in $tb_name ;
do
tbl_count=`mysql -u $user -p$pwd -h$ip -P$port -e "select SQL_CALC_FOUND_ROWS 1 FROM $1.$name limit 1;SELECT found_rows() AS rowcount;"|awk 'NR==4{print $1}'`
echo "$name=$tbl_count" >>/date/$1.log
done
标签:...,rows,name,ip,mysql,库表,全库,port 来源: https://www.cnblogs.com/dxian1028/p/12028306.html