Skip to content

Repair broken MySQL tables

Jan Schulte edited this page Feb 20, 2017 · 1 revision

From time to time this error will occur (with MySQL < 5.7), mostly because the POI table uses MyISAM as storage engine.

Mysql2::Error: Incorrect key file for table './wheelmap_production/pois.MYI'; try to repair it

To fix this, you have to run follow these steps:

  1. Backup the current database
$ mysqldump -u <username> -p <database> > ~/dump.sql
  1. Then shutdown the application process
$ sudo /etc/init.d/unicorn_production stop
  1. Repair the tables (Run this in screen or tmux preferably)
$ mysqlcheck -u <username> -p --repair --databases db_name