mysqlcheck

checks, repairs, and optimizes MySQL tables

TLDR

Check all tables in database
$ mysqlcheck -u [user] -p [database]
Check all databases
$ mysqlcheck -u [user] -p --all-databases
Repair tables
$ mysqlcheck -u [user] -p --repair [database]
Optimize tables
$ mysqlcheck -u [user] -p --optimize [database]
Analyze tables
$ mysqlcheck -u [user] -p --analyze [database]
Check specific table
$ mysqlcheck -u [user] -p [database] [table]
Auto repair
$ mysqlcheck -u [user] -p --auto-repair [database]

SYNOPSIS

mysqlcheck [options] [database] [tables]

DESCRIPTION

mysqlcheck checks, repairs, and optimizes MySQL tables. It maintains database integrity.The tool runs CHECK, REPAIR, ANALYZE, and OPTIMIZE. Essential for database maintenance.

PARAMETERS

DATABASE

Database name.
TABLES
Specific tables to check.
--all-databases
Check all databases.
--repair
Repair corrupted tables.
--optimize
Optimize tables.
--analyze
Analyze tables.
--auto-repair
Auto repair issues.
--help
Display help information.

INSTALL

sudo apk add mariadb-client
sudo zypper install mariadb-client

CAVEATS

May lock tables. Backup before repair. Some engines don't support all operations.

HISTORY

mysqlcheck is part of the MySQL distribution for table maintenance and repair operations.

SEE ALSO

mysql(1), mysqladmin(1), mysqldump(1)