MySQL命令行实用工具详解
1. myisamchk工具
myisamchk是一个用于检查、修复和优化MyISAM表的实用工具。
1.1 检查单个表
要检查单个MyISAM表,可以使用以下命令:
myisamchk /data/mysql/workrequests/requests
执行该命令后,会输出表的相关信息,如数据记录数、删除块数等。示例输出如下:
Checking MyISAM file: /data/mysql/workrequests/requests
Data records: 531 Deleted blocks: 0
myisamchk: warning: 3 clients is using or hasn't closed the table properly
- check file-size
- check key delete-chain
- check record delete-chain
- check index reference
- check data record references index: 1
- check record links
MyISAM-table '/data/mysql/workrequests/requests' is usable but should be
fixed
这里没有指定选项,默认使用 --check
选项。如果检测到表有问题,可以使用