HostOnNet Blog

Repair MySQL MyISAM Database with myisamchk

myisamchk is a command line tool to repair MySQL MyISAM database. You need to run it a user root.

To repair all MyISAM tables in a database, run

myisamchk --silent --force --fast --update-state /var/lib/mysql/w3blogs/*.MYI

Example

[root@localhost ~]# myisamchk --recover /var/lib/mysql/w3blogs/wp_blogs
- recovering (with sort) MyISAM-table '/var/lib/mysql/w3blogs/wp_blogs'
Data records: 199
- Fixing index 1
- Fixing index 2
- Fixing index 3
[root@localhost ~]#

This is useful during crash recovery when you have many MySQL database tables require repair.


Posted in MySQL