After running mysqlcheck -udbuser -p --auto-repair --optimize --databases mydrupaldb, I got the following error.

cache_form error: myisam_sort_buffer_size is too small

Someone has suggested that it should be solved by increasing sort_buffer_size parameter, for example with myisamchk -r -q cache_form.MYI --sort_buffer_size=2G. Executing this command causes the following error.

myisamchk: error: File 'cache_form.MYI' doesn't exist

How can I fix it?


mysqlcheck is a client utility that actually logs into mysql

myisamchk is a client utility that does not require logging in. It does require

  • access the raw file(s) needed, provided the datafile is not in use by the mysqld process
  • your current directory is wherever the datafile is located

For the table mydrupaldb.cache_form, here is what you must do:

  • Step 01) Run this query : SHOW VARIABLES LIKE 'datadir'; In most instances, this will be /var/lib/mysql. For the sake of this example, let's assume it is /var/lib/mysql.
  • Step 02) cd /var/lib/mysql/mydrupaldb
  • Step 03) service mysql stop
  • Step 04) myisamchk -r -q cache_form.MYI --sort_buffer_size=2G
  • Step 05) service mysql start

Give it a Try !!!

CAVEAT : The error message probably means you were not standing in the proper directory where cache_form.MYI is located at the time you first ran myisamchk.

| improve this answer | |
  • Rolando, following your instructions led to: "myisamchk: error: Couldn't fix table with quick recovery: Found wrong number of deleted records myisamchk: error: Run recovery again without -q MyISAM-table 'cache_form.MYI' is not fixed because of errors Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag". However, it seems to have been eventually fixed after running a through repaid command. – alfish Dec 12 '11 at 2:07

Try shrinking the cache_form table

On high-traffic sites, cache_form can get overly large. See this core issue: Make cache_form expiration configurable, to mitigate runaway cache_form tables.

I've posted more information in this Drupal stackexchange answer on what to do when "Cache Form table size is enormous".

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.