Home Guides Glossary

Why do I get a MySQL "error: 1016 Can't open file: ..."?

Errors such as: ..."Got error: 1016: Can't open file: 'YOUR_TABLE_NAME.MYI'. (error:145) when using LOCK TABLES"... (as well as numerous other noted below) are caused by MySQL table corruption. Table corruption can be caused by a variety of events, and will make some or all of a table unavailable.

Table corruption can also significan'tly decrease the performance of queries on effected tables. Table corruption can be be repaired by using the the REPAIR TABLE command.

For more information about the REPAIR TABLE command see:

MySQL 4.0, 4.1

http://dev.mysql.com/doc/refman/4.1/en/repair-table.html

MySQL5.0

http://dev.mysql.com/doc/refman/5.0/en/repair-table.html

Run REPAIR TABLE on an affected table

  1. Enter phpMyAdmin for the database you want to use. For more information, see Log in to phpMyAdmin.
  2. Click on the table name of the affected table.

    If phpMyAdmin is unable to display the table information, or encounters errors loading the table details page, another option would be to use the SQL button at the top of the left frame to enter your own query. You can repair the table manually by issuing the command REPAIR TABLE <tablename> in this SQL window.

  3. Click on the Operations tab at the top of the right panel.
  4. Click Repair table at the bottom of the right panel.

This command can take some time and will block some queries, such as inserts, to the table.

WARNING:It is possible that the phpMyAdmin Web server will time out waiting for a response from this command. If this happens, do not issue it again. Use the processlist feature, and you'll likely see the REPAIR command still running. Wait for it to complete. On large tables, this can take hours.

Some other errors that may be caused by table corruption include:

  • Can't find file table.MYI.
  • Duplicate unique key or constraint on write or update.
  • Got error ERR from table handler. (ERR being a number).
  • Index file is crashed / Wrong file format.
  • No more room in index file.
  • No more room in record file.
  • Old database file.
  • Record file is crashed.
  • Record was already deleted (or record file crashed).
  • table.frm is locked against change.
  • Table is crashed and last repair failed.
  • Tables was marked as crashed and should be repaired.
  • Unexpected end of file.

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

Build an amazing website in just under an hour with Website Builder. Take advantage of designs created just for your industry and then customize them to reflect your one-of-a-kind idea.

Website Security

Protect your website and keep customers safe. Your comprehensive Website Security solution. Get peace of mind by securing your websites.

cPanel Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate
Copyright © 2005 - 2024.  All rights reserved.  Privacy Policy