DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) myisamchk

Info Catalog (mysql.info) client-utility-overview (mysql.info) client-utility-programs (mysql.info) myisamlog
 
 8.2 `myisamchk' -- `MyISAM' Table-Maintenance Utility
 =====================================================
 

Menu

 
* myisamchk-general-options    `myisamchk' General Options
* myisamchk-check-options      `myisamchk' Check Options
* myisamchk-repair-options     `myisamchk' Repair Options
* myisamchk-other-options      Other `myisamchk' Options
* myisamchk-memory             `myisamchk' Memory Usage
 
 The `myisamchk' utility gets information about your database tables or
 checks, repairs, or optimizes them. `myisamchk' works with `MyISAM'
 tables (tables that have `.MYD' and `.MYI' files for storing data and
 indexes).
 
 Invoke `myisamchk' like this:
 
      shell> myisamchk [OPTIONS] TBL_NAME ...
 
 The OPTIONS specify what you want `myisamchk' to do. They are described
 in the following sections. You can also get a list of options by
 invoking `myisamchk --help'.
 
 With no options, `myisamchk' simply checks your table as the default
 operation. To get more information or to tell `myisamchk' to take
 corrective action, specify options as described in the following
 discussion.
 
 TBL_NAME is the database table you want to check or repair. If you run
 `myisamchk' somewhere other than in the database directory, you must
 specify the path to the database directory, because `myisamchk' has no
 idea where the database is located. In fact, `myisamchk' doesn't
 actually care whether the files you are working on are located in a
 database directory.  You can copy the files that correspond to a
 database table into some other location and perform recovery operations
 on them there.
 
 You can name several tables on the `myisamchk' command line if you
 wish. You can also specify a table by naming its index file (the file
 with the `.MYI' suffix). This allows you to specify all tables in a
 directory by using the pattern `*.MYI'. For example, if you are in a
 database directory, you can check all the `MyISAM' tables in that
 directory like this:
 
      shell> myisamchk *.MYI
 
 If you are not in the database directory, you can check all the tables
 there by specifying the path to the directory:
 
      shell> myisamchk /path/to/database_dir/*.MYI
 
 You can even check all tables in all databases by specifying a wildcard
 with the path to the MySQL data directory:
 
      shell> myisamchk /PATH/TO/DATADIR/*/*.MYI
 
 The recommended way to quickly check all `MyISAM' tables is:
 
      shell> myisamchk --silent --fast /PATH/TO/DATADIR/*/*.MYI
 
 If you want to check all `MyISAM' tables and repair any that are
 corrupted, you can use the following command:
 
      shell> myisamchk --silent --force --fast --update-state \
                --key_buffer_size=64M --sort_buffer_size=64M \
                --read_buffer_size=1M --write_buffer_size=1M \
                /PATH/TO/DATADIR/*/*.MYI
 
 This command assumes that you have more than 64MB free. For more
 information about memory allocation with `myisamchk', see 
 myisamchk-memory.
 
 You must ensure that no other program is using the tables while you are
 running `myisamchk'. Otherwise, when you run `myisamchk', it may
 display the following error message:
 
      warning: clients are using or haven't closed the table properly
 
 This means that you are trying to check a table that has been updated
 by another program (such as the `mysqld' server) that hasn't yet closed
 the file or that has died without closing the file properly.
 
 If `mysqld' is running, you must force it to flush any table
 modifications that are still buffered in memory by using `FLUSH
 TABLES'. You should then ensure that no one is using the tables while
 you are running `myisamchk'. The easiest way to avoid this problem is
 to use `CHECK TABLE' instead of `myisamchk' to check tables.
 
Info Catalog (mysql.info) client-utility-overview (mysql.info) client-utility-programs (mysql.info) myisamlog
automatically generated byinfo2html