LinuxCommandLibrary

mysqlcheck

checks, repairs, and optimizes MySQL tables

TLDR

Check all tables in database

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

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.

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community