Common SQL Errors

MySQL Error 1805 ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2: Column Count Mismatch - Fix & Prevent

Galaxy Team
August 7, 2025

<p>MySQL throws error 1805 when the stored column count for a table differs from the actual definition, indicating table corruption.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1805 ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2?

<p>MySQL Error 1805 ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 happens when MySQL detects that the number of columns recorded in the .frm file differs from the real table structure. Running CHECK TABLE and then REPAIR TABLE or recreating the table usually resolves the corruption.</p>

Error Highlights

Typical Error Message

Column count of %s.%s is wrong. Expected %d, found %d.

Error Type

Data Corruption Error

Language

MySQL

Symbol

ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2

Error Code

1805

SQL State

HY000

Explanation

Table of Contents

What does “Column count of %s.%s is wrong” mean?

Error 1805 signals that MySQL expected one column count but found another when opening the table definition file. The mismatch flags internal corruption.

The server refuses to access the table to protect data integrity, so queries that read or write to the table fail immediately.

When does Error 1805 appear?

The message can surface during SELECT, INSERT, UPDATE, or ALTER operations that touch the corrupted table. It also shows up after server restarts when MySQL’s metadata cache refreshes.

Databases running on unreliable disks or after abrupt crashes are most prone, but version upgrades with incompatible storage formats can trigger the issue as well.

Why is fixing it urgent?

Ignoring corruption risks permanent data loss if the damage spreads. Repairing early restores application uptime and prevents cascading failures during backups or replication.

Common Causes

Crash during DDL

If mysqld stops unexpectedly while adding or dropping columns, the .frm file may be only partially updated.

File system errors

Bad sectors, disk full events, or sudden power loss can corrupt InnoDB’s data dictionary or MyISAM’s .frm files.

Storage engine bugs

Older MySQL versions contain known defects that write incorrect metadata after ALTER TABLE operations.

Manual file copy

Moving .frm or .ibd files between servers without matching engine settings causes column count mismatches.

Related Errors

MySQL Error 1194: ER_CRASHED

Occurs when a MyISAM table is marked as crashed. REPAIR TABLE usually resolves it.

MySQL Error 145: ER_NISAMCHK

Indicates problems in the .MYI index file. Similar repair steps apply.

MySQL Error 1022: ER_DUP_KEYNAME

Arises during ALTER TABLE when duplicate index names exist, but no corruption.

MySQL Error 1806: ER_TABLE_NEEDS_UPGRADE

Shown when a table uses an older row format after a server upgrade.

FAQs

Is my data lost when this error appears?

Usually not. The data pages are often intact; only the metadata header is corrupt. Timely repair recovers the table.

Does REPAIR TABLE work for InnoDB?

No. InnoDB tables require ALTER TABLE ... FORCE or a dump and reload. REPAIR TABLE affects MyISAM only.

Can I ignore the error and keep the server running?

The server stays up, but any query touching the table fails. Other tables remain accessible.

How does Galaxy help?

Galaxy’s editor surfaces CHECK TABLE errors instantly and lets teams share repair scripts, reducing downtime.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo