mysql,

MySQL Check for Corrupted Tables

Feb 02, 2022 · 1 min read · Post a comment
MySQL Check for Corrupted Tables

Exporting and importing MySQL databases and tables sometimes can cause corruption. But there are a lot of different reasons why the MySQL table can get corrupted. Here in this tutorial, I will show you how can you check that.

Prerequisites

  • MySQL admin access

Check all Databases and Tables

sudo mysqlcheck -A -u root -p

or

sudo mysqlcheck -c  -u root -p --all-databases

Sample Output:

mysql.columns_priv                                 OK
mysql.component                                    OK
mysql.db                                           OK
mysql.default_roles                                OK
mysql.engine_cost                                  OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.global_grants                                OK
mysql.gtid_executed                                OK

Check one Table from specific Database

sudo mysqlcheck -c devcoops_db users -u root -p
  • devcoops_db - replace with your database name
  • users - replace with your table name

Example output:

devcoops_db.users    OK

Check all Tables in specific Database

sudo mysqlcheck -c devcoops_db  -u root -p

You need to specify only the database and left an empty space.

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.