MySQL Internals Manual  /  ...  /  MyISAM Files

21.2.1 MyISAM Files

Some notes about MyISAM file handling:

  • If a table is never updated, MySQL will never touch the table files, so it would never be marked as closed or corrupted.

  • If a table is marked readonly by the OS, it will only be opened in readonly mode. Any updates to it will fail.

  • When a normal table is opened for reading by a SELECT, MySQL will open it in read/write mode, but will not write anything to it.

  • A table can be closed during one of the following events:

    • Out of space in table cache

    • Someone executed flush tables

    • MySQL was shut down

    • flush_time expired (which causes an automatic flush-tables to be executed)

  • When MySQL opens a table, it checks if the table is clean. If it isn't and the server was started with the --myisam-recover option, check the table and try to recover it if it's crashed. (The safest automatic recover option is probably --myisam-recover=BACKUP.)