What is the use of CHECK TABLE statement in maintaining the MySQL tables?

MySQLMySQLi Database

There may be something wrong which can happen to the database server e.g., the server was shutdown unexpectedly, error while writing data to the hard disk, etc. These situations could make the database operate incorrectly and in the worst case, it can be crashed.

With the help of CHECK TABLE statement MySQL allows us to check the integrity of database tables. Its syntax would be as follows −

CHECK TABLE table_name

Here, table_name is the name of the table.

Example

We are running this statement for the table Student_info as follows −

mysql> CHECK table student_info\G
*************************** 1. row ***************************
   Table: query.student_info
      Op: check
Msg_type: status
Msg_text: OK
1 row in set (0.00 sec)
raja
Published on 20-Feb-2018 13:55:43
Advertisements