Team LiB
Previous Section Next Section


The myisampack utility produces compressed, read-only tables. It achieves typical storage requirement reductions of 40% to 70% while maintaining fast record access. myisampack packs MyISAM tables and works with all data types.

No special version of the MySQL server is needed to read tables that have been packed with myisampack. This makes them especially applicable for applications for which you want to distribute a table containing archival or encyclopedic information that is read-only and need not be updated. For example, if you are setting up a CD-ROM for an application that uses the embedded server, you'll be able to pack more data on the disk by using compressed MyISAM tables.

If you want to convert a packed file back to unpacked and modifiable form, you can do so by using myisamchk --unpack.


myisampack [options] tbl_name ...

A tbl_name argument can be either the name of a table or the name of the index file for the table. (For MyISAM tables, index files have an extension of .MYI.) The name must include the pathname to the directory in which the table is located if you are not in that directory.

myisampack packs data files but does not touch index files, so after using it, you must update the indexes by running myisamchk --recover --quick.

Standard Options Supported by myisampack

--character-sets-dir  --help                --verbose
--debug               --silent              --version

Options Specific to myisampack

  • --backup, -b

    Make a backup of the data file for each tbl_name argument as tbl_name.OLD before packing it.

  • --force, -f

    Force a table to be packed even if the resulting packed file is larger than the original or if a temporary file for the table already exists. Normally, myisampack simply exits after printing an error message if it finds a file named tbl_name.TMD, because that might indicate that another instance of the program is already running. However, the file might also exist because you killed a previous invocation of myisampack while it was running, in which case the file safely can be removed. If you know that to be the case, use --force to tell myisampack to pack the table even if the temporary file exists. (Alternatively, you can remove the temporary file manually.)

  • --join=join_tbl, -j join_tbl

    Join (merge) all the tables named on the command line into a single packed table named join_tbl. All the tables to be merged must have the same structure. (Column names, types, and indexes must be identical.) This option is unrelated to MERGE tables.

  • --test, -t

    Run in test mode. A packing test is run, and information is printed about the results you would obtain if you actually packed the table.

  • --tmpdir=dir_name, -T dir_name

    The pathname of the directory to use for temporary files.

  • --wait, -w (boolean)

    Wait and retry if a table is in use. (You should not pack a table if it might be updated while you're packing it.)

    Team LiB
    Previous Section Next Section