mysqlcheck 修复数据库表

admin 2019-01-17 PM 520℃ 0条

修复某个数据库所有表

mysqlcheck  -r  -uroot -p  dbname



修复指定表

mysqlcheck  -r  -uroot -p  dbname  tablename



修复所有数据库表

mysqlcheck -A -o -r -p -uroot -p



自动检查、优化修复、分析所有表

mysqlcheck -Aao --auto-repair -uroot -p



myisamchk 修复表

myisamchk -r 数据文件目录/数据表名.MYI  
myisamchk -r /www/wdlinux/mysql/var/*/*.MYI 
#如数据库表比较大修复失败,可加--sort_buffer_size=2G
myisamchk -r /www/wdlinux/mysql/var/*/*.MYI --sort_buffer_size=2G


mysqlcheck 常用选项

-A, –all-databases 表示所有库
-a, –analyze 分析表
-o, –optimize 优化表
-r, –repair 修复表错误
-c, –check 检查表是否出错
–auto-repair 自动修复损坏的表
-B, –databases 选择多个库
-1, –all-in-1 Use one query per database with tables listed in a comma separated way
-C, –check-only-changed 检查表最后一次检查之后的变动
-g, –check-upgrade Check for version dependent changes in the tables
-F, –fast Check tables that are not closed properly
–fix-db-names Fix DB names
–fix-table-names Fix table names
-f, –force Continue even when there is an error
-e, –extended Perform extended check on a table. This will take a long time to execute.
-m, –medium-check Faster than extended check option, but does most checks
-q, –quick Faster than medium check option
标签: none

非特殊说明,本博所有文章均为博主原创。