With a little side of applesauce...

Thursday, February 1, 2007

BASH command to check all MyISAM tables in multiple databases

The command to check all of the tables in the database is:

mysql:/home/mysql/data# for i in $(ls); do /home/mysql/bin/mysqlcheck -c $i -u adminuser -pmypass >> mysql_corrupt.txt ; done

This will output the results into mysql_corrupt.txt with the following format:

my_table.expensedetail_tbl OK
my_table.fiscalyear OK
my_table.hours_tbl OK
my_table.job_tbl OK
my_table.job_tblalias OK
my_table.jobdetail_tbl OK
my_table.lstDeliverable OK
my_table.lstPriceCodes
error : Incorrect information in file: './my_table/lstPriceCodes.frm'
my_table.milestone_xref OK
my_table.payment_tbl OK
my_table.payment_xref OK

No comments: