One of these errors might appear on your website without warning:
Warning: DB function failed with error number 1033 Incorrect information in file: './database_name/table_name.frm' SQL=SELECT col1, col2 FROM table_name WHERE col3 = 'some_value' ORDER BY col1 ASC
MySQL is telling you that the table structure it has within data files doesn’t match the structure in the
.frm file that’s on the disk. There’s only a few scenarios where this can happen:
Different version of the .frm files
If the .frm files from an older or later version of the table are placed in MySQL’s data directory, MySQL will become confused and it won’t be able to determine the proper database structure.
Pending table alteration
A pending database operation that ran an
ALTER TABLE may not have written changes to the disk. MySQL may have stopped running abruptly or the entire server may have crashed. The normal operation for MySQL is to make changes in memory first and then perform disk operations.
I cannot explain it, and I can’t figure out the logic that would allow it to happen, but some web application vulnerabilities can cause this problem. I’ve seen it happen with Joomla! sites running on fairly secure servers, and there was no Apache privilege escalation used to modify the .frm files directly.
How is it fixed? The only way to repair it is to import the table again from a mysqldump backup, find the correct .frm file and restore it on the server, or run an
ALTER TABLE to bring the table back to its original state.