Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL check for crashed table

Tags:

mysql

I notice that when phpMyAdmin opens a DB it shows immediately if a table has crashed or not. It thus seems to me that phpMyAdmin is not running a CHECK TABLE or ANALYZE TABLE.

Does anybody know what it does to obtain this informaiton so quickly and efficiently?

like image 971
Adrien Hingert Avatar asked Feb 02 '12 11:02

Adrien Hingert


People also ask

How do I run MySQL check?

Part 2: Running mysqlcheck Command To use the mysqlcheck table command and check tables, follow these steps: Step 1: As an administrator, change your directory to MySQL Data Directory. Step 2: Now type in the mysqlcheck command to check for an existing table in a database.

What is Mysqlcheck?

mysqlcheck is a maintenance tool that allows you to check, repair, analyze and optimize multiple tables from the command line. It is essentially a commandline interface to the CHECK TABLE, REPAIR TABLE, ANALYZE TABLE and OPTIMIZE TABLE commands, and so, unlike myisamchk and aria_chk, requires the server to be running.


2 Answers

show table status where comment like '%crash%';
like image 123
Soap Hope Avatar answered Oct 08 '22 01:10

Soap Hope


The most efficient way I have found is to use the commandline mysqlcheck tool:

mysqlcheck -u mydbuser -p mydbname

This will access mydbname using user mydbuser and prompting for that user's password. It will then check 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 it, so this is not strictly an answer for the original question, but I'm putting this here because Google sends searches for mysql show crashed tables here.

like image 38
jeff-h Avatar answered Oct 08 '22 00:10

jeff-h