Exporting and importing MySQL databases and tables sometimes can cause corruption. And, 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
- sudo privileges
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.
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.