Bug #101239 mysqlcheck lacks documentation on output format or return codes
Submitted: 20 Oct 10:28 Modified: 20 Oct 10:59
Reporter: Jaime Crespo (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: check tables, documentation, mysqlcheck, Output, return

[20 Oct 10:28] Jaime Crespo
As a mysql user, I want to check all tables of my MySQL server (as we had recently some index corruption) and understand which ones had errors (were not ok).

I used mysqlcheck rather than SQL "check table" directly so I don't have to handle the logic of going over all tables.

I checked the manual (and man page) for mysql check: https://dev.mysql.com/doc/refman/8.0/en/mysqlcheck.html and it doesn't mention what it outputs, other than mentioning it uses standard CHECK TABLE commands, for the default option.

Does it return 0 if all tables are without errors? What does it return if not? Does it always return 0 and we are supposed to parse the output? If we are supposed to parse the output, how does it return the sql output (tab separated?).

How to repeat:
Go to https://dev.mysql.com/doc/refman/8.0/en/mysqlcheck.html or execute "man mysqlcheck" ( https://github.com/mysql/mysql-server/blob/8.0/man/mysqlcheck.1 ) or "mysqlcheck --help" and try to respond the above questions.

Suggested fix:
Add an "output" section or paragraph both on MySQL official documentation and man page with the detailed output of each mysqlcheck option return to stdout/stderr and return code.

I don't mind if it always returns 0 (if it runs CHECK TABLE correctly, as it is difficult to provide meaningful return codes on commands that do multiple things) as long as it is documented. I will have to check the source code to know what it really does.
[20 Oct 10:59] MySQL Verification Team
Hello Jaime,

Thank you for the report!