Common SQL Errors

MySQL Error 18: EE_LINK_WARNING - How to Fix and Prevent

Galaxy Team
August 5, 2025

MySQL raises EE_LINK_WARNING (Error 18) when a CHECK or REPAIR operation detects mismatched link counters in a MyISAM or ISAM table, signaling possible data corruption.

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 18 EE_LINK_WARNING?

MySQL Error 18 EE_LINK_WARNING appears when CHECK TABLE or REPAIR TABLE finds link inconsistencies inside MyISAM or ISAM files. Rebuild the table with myisamchk --recover or run ALTER TABLE ... ENGINE=InnoDB to eliminate the bad links and clear the warning.

Error Highlights

Typical Error Message

Warning: '%s' had %d links

Error Type

Runtime Warning

Language

MySQL

Symbol

EE_LINK_WARNING

Error Code

18

SQL State

Explanation

Table of Contents

What is MySQL Error 18 EE_LINK_WARNING?

MySQL emits “Warning: '%s' had %d links” with error code 18 (symbol EE_LINK_WARNING) when it discovers a mismatch between the stored link counter and the actual number of rows in a MyISAM or legacy ISAM table.

The warning usually surfaces during CHECK TABLE, REPAIR TABLE, OPTIMIZE TABLE, or myisamchk commands, indicating internal pointers that no longer reference valid rows.

Ignoring it risks wrong result sets and replication drift.

When Does EE_LINK_WARNING Occur?

The server or myisamchk sets the warning flag after abnormal shutdowns, interrupted writes, disk faults, or improper file copies that leave .MYI headers out of sync with .MYD data pages.

It can also appear after bulk DELETE or TRUNCATE operations if the link counter update fails to flush to disk on older MySQL versions (5.7 and earlier).

Why Is Fixing It Important?

Link‐counter corruption may hide orphaned rows or phantom entries that break foreign-key logic, full-text indexes, and incremental backups.

Fast remediation maintains data integrity and avoids cascading errors during replication or logical export.

What Causes This Error?

Hardware I/O errors, abrupt power loss, and OS crashes are primary triggers. Manual file moves without FLUSH TABLES WITH READ LOCK can desynchronize file metadata. Running out of disk space during writes is another frequent cause.

How to Fix MySQL Error 18 EE_LINK_WARNING

First, isolate the affected table with a READ LOCK. Then run myisamchk --recover or REPAIR TABLE tbl_name QUICK.

If corruption persists, rebuild by dumping and reloading or migrating to InnoDB.

Common Scenarios and Solutions

On replicas, stop SQL thread, copy a clean .MYD/.MYI pair from the primary, and start replication. For high-availability clusters, fail over first to preserve uptime, then repair the offline node.

Best Practices to Avoid This Error

Store tables on reliable storage with write-cache safely off. Enable sync_binlog and innodb_flush_log_at_trx_commit for transactional engines.

Schedule regular CHECK TABLE in low-traffic windows, and prefer InnoDB for new tables.

Related Errors and Solutions

Error 127 (ER_UNKNOWN_ERROR) often accompanies severe MyISAM corruption. Error 1194 (ER_WARNING_NOT_COMPLETE_ROLLBACK) signals partial rollbacks. Their root causes and fixes overlap; a full dump-reload cycle resolves both.

.

Common Causes

Related Errors

FAQs

How dangerous is EE_LINK_WARNING?

While labeled a warning, it indicates metadata corruption that can yield incorrect query results if left untreated.

Can I ignore the warning if queries work?

No. Hidden corruption can surface later, cause replication errors, or block backups. Always repair promptly.

Does InnoDB ever raise EE_LINK_WARNING?

No. The warning is specific to MyISAM and ISAM tables. Migrating to InnoDB eliminates this risk.

How does Galaxy help prevent this error?

Galaxy’s versioned query workspace encourages scheduled CHECK TABLE routines and surfaces engine warnings immediately in the editor, prompting early fixes.

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