Skip to content

Instantly share code, notes, and snippets.

@mikecharles
Created May 17, 2016 18:48
Show Gist options
  • Select an option

  • Save mikecharles/fb43b5ea26c2cb98705da0a3d18fa055 to your computer and use it in GitHub Desktop.

Select an option

Save mikecharles/fb43b5ea26c2cb98705da0a3d18fa055 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment