Tuesday, March 15, 2011

Shell script to travel through Mysql database tables

TABLES=$($MYSQL -u $MUSER -p$MPASS $MDB -e 'show tables' | $AWK '{ print $1}' | $GREP -v '^Tables' )

for t in $TABLES
do
echo "checking $t table from $MDB database..."
$MYSQL -u $MUSER -p$MPASS $MDB -e "check table $t"
done

I found it in Net .. might be useful ..

No comments:

Post a Comment