mysql / gbase whole library library database table records the number of

file:mysql_rows.sh

Run: sh mysql_rows.sh library name

Script Content:

#!/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

Guess you like

Origin www.cnblogs.com/dxian1028/p/12028306.html