mikecharles
5/17/2016 - 6:48 PM

Find corrupt MySQL database tables that

Find corrupt MySQL database tables that

echo "The following MySQL database tables are corrupt:"
mysql -Nse "show databases" | while read database ; do
  mysql -Nse "show tables from $database" | while read table ; do
    test=`mysql -e "select * from ${database}.${table} limit 1" 2> /dev/null`
    if [[ $? -ne 0 ]] ; then
      echo "${database}.${table}"
    fi
  done
done