MySQL checks a broken table

I notice that when phpMyAdmin opens the database, it immediately appears if the table crashed or not. It seems to me that phpMyAdmin does not start CHECK TABLE or ANALYZE TABLE .

Does anyone know what he is doing to get this information so quickly and efficiently?

+6
source share
4 answers

I bet that

 SHOW TABLE STATUS FROM `db` 

- this is what you are looking for.

Take a look at this line. I think if the ENGINE is zero (empty), it could be due to a table failure

+5
source

If you have shell access, mysqlanalyze can help.

 mysqlanalyze dbname 

Official documentation

+3
source
 show table status where comment like '%crash%'; 
+3
source

The most efficient way I've found is to use the mysqlcheck command line mysqlcheck :

mysqlcheck -u mydbuser -p mydbname

This will cause mydbname to be mydbuser using the mydbuser user and cause the password for that user. Then it checks each table in the specified database.

See https://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html

Note: this is not how phpMyAdmin does this, so it is not a strict answer to the original question, but I put it here because Google sends mysql show crashed tables requests here.

0
source

Source: https://habr.com/ru/post/907480/


All Articles