Created
May 17, 2016 18:48
-
-
Save mikecharles/fb43b5ea26c2cb98705da0a3d18fa055 to your computer and use it in GitHub Desktop.
Find corrupt MySQL database tables that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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