Just wanted to know, is it possible to load mysqlcheck output into table.

Created table in workbench.

use db_test;
CREATE TABLE checktable_status (name varchar(8000), status varchar(10)) ;

In BAT file having this.

mysql -u root --password=somepassword --port=port_no
insert into db_test.checktable_status
mysqlcheck --check  -u root --password=somepassword --port=port_no --all-databases
  • 1
    Save the output into a file. Then load this file with another query (SELECT LOAD_FILE(filename)), parse it and save into the table.
    – Akina
    Dec 14, 2022 at 8:06
  • Thanks for the update, let me try it. Dec 14, 2022 at 10:30
  • SELECT LOAD_FILE('G:\MYSQL_Backup\DBCC\mysqlcheck_log.txt') AS Result; . I have tried and it is retuning single value as null. I have changed \ to / as well. Dec 14, 2022 at 10:49
  • Got this error. mysql> SELECT LOAD_FILE('C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/mysqlcheck_log.txt') AS Result; +----------------+ | Result | +----------------+ | 0x4D75746875 | +----------------+ 1 row in set (0.00 sec) Dec 14, 2022 at 11:29
  • LOAD_FILE loads the whole file as solid string. You must parse it, not save as-is.
    – Akina
    Dec 14, 2022 at 12:35


Your Answer

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

Browse other questions tagged or ask your own question.