0

I am trying to check for corrupt tables in mysql database while it is running. This check will be done in a service which will run continues. I was looking at mysqlcheck, but the documentations says that it locks and unlocks a table. Is mysqlcheck time efficient to use in a service, and if not what is a better approach/

3
  • 1
    How often are you encountering corrupt tables in MySQL that this is something you need to continuously monitor for?
    – esqew
    Commented May 4, 2022 at 18:16
  • yes it is something i need to continously check for. One corrupt table will affect other components Commented May 4, 2022 at 18:41
  • 2
    No you don't. If corruption happens too frequently for your taste, you'll need to find the reason and address it. If MySQL encounters a corrupted table, it will write a record in the error log; it should be sufficient to monitor that.
    – mustaccio
    Commented May 4, 2022 at 19:32

1 Answer 1

1

I won't answer the question you asked; instead I will try to dissuade you from thinking you need to ask that question.

Do not use MyISAM; it can become corrupt sometimes, (rarely).

Do use InnoDB; it essentially never becomes corrupt, even across nasty crashes.

Do not expect any disk crash to be repairable. Use other techniques to recover from such.

Bottom line: mysqlcheck is often needed for MyISAM after a power failure. However, mysqlcheck is both useless and unneeded for InnoDB.

1
  • +1 for crashes not being repairable. If someone crashes their car, they probably wouldn't try to drive that car again straight away - they would get /another/ car that is safe to use. This is why [we] DBAs make such a "Song and Dance" about keeping /proper/ Backups.
    – Phill W.
    Commented May 5, 2022 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.