isamchk pour réparer une tableThe file format that MySQL uses to store data has been extensively tested, but there are always external circumstances that may cause database tables to become corrupted:@:
mysqld process being killed in the middle of a write
This chapter describes how to check for and deal with data corruption in MySQL databases. If your tables get corrupted a lot you should try to find the reason for this! G.1 Debugguer un serveur MySQL.
When performing crash recovery, it is important to understand that each table
nom_table in a database corresponds to three files in the database
directory:@:
| File | Purpose |
| `nom_table.frm' | Table definition (form) file |
| `nom_table.ISD' | Data file |
| `nom_table.ISM' | Index file |
Each of these three file types is subject to corruption in various ways, but problems occur most often in data files and index files.
isamchk works by creating a copy of the `.ISD' (data) file row by
row. It ends the repair stage by removing the old `.ISD' file and
renaming the new file to the original file name. If you use --quick,
isamchk does not create a temporary `.ISD' file, but instead
assumes that the `.ISD' file is correct and only generates a new index
file without touching the `.ISD' file. This is safe, because
isamchk automatically detects if the `.ISD' file is corrupt and
aborts the repair in this case. You can also give two --quick options
to isamchk. In this case, isamchk does not abort on some
errors (like duplicate key) but instead tries to resolve them by
modifying the `.ISD' file. Normally the use of two --quick
options is useful only if you have too little free disk space to perform a
normal repair. In this case you should at least make a backup before running
isamchk.