Updated: 11 October 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8
mysqlcheck checks, repairs, optimizes and analyzes tables while the database server is running. You can use it on one table, one database or all databases.
Examples
mysqlcheck -c shopdb orders # check one table mysqlcheck -r shopdb orders # repair one table (MyISAM/Aria) mysqlcheck -o shopdb # optimize every table in a database mysqlcheck -a shopdb # update index statistics (analyze) mysqlcheck --all-databases --auto-repair # check all, repair only when needed
Add -u USER -p if you are not using the root account's saved credentials (on cPanel servers, root's ~/.my.cnf is used automatically).
Note: Optimize and repair lock tables while they run. InnoDB tables do not support repair; for those, "optimize" rebuilds the table.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
