<p>The server rejects attempts to drop the built-in DEFAULT key cache used by the MyISAM storage engine.</p>
<p>MySQL Error 1438: ER_WARN_CANT_DROP_DEFAULT_KEYCACHE happens when you run DROP KEY_CACHE default or an ALTER KEY_CACHE command that targets the DEFAULT cache. MySQL blocks the action because the DEFAULT key cache is required for MyISAM index buffering. Use CREATE KEY_CACHE with a custom name and assign tables to it instead.</p>
Cannot drop default keycache
The message "Cannot drop default keycache" appears when MySQL receives a DROP KEY_CACHE statement that names the reserved DEFAULT cache. The server refuses the request because the DEFAULT key cache is always needed for MyISAM index buffering.
The error is emitted at runtime with SQLSTATE HY000 and warns the administrator that the operation is skipped. Although flagged as a warning, the statement fails to perform the requested drop.
You see the warning during maintenance scripts that try to replace the DEFAULT cache or when migrating legacy code that assumes the cache can be removed. It also appears if an ALTER KEY_CACHE command attempts to rename the DEFAULT cache.
Ignoring the warning leaves unnecessary commands in deployment scripts, causing noisy logs and confusion during automated rollouts. Cleaning the scripts eliminates failed statements and keeps administration routines predictable.
The DEFAULT key cache buffers MyISAM index blocks in memory. Other named caches can be created to isolate hot tables, but the DEFAULT cache must remain present for any table that is not explicitly bound to another cache.
Do not attempt to drop the DEFAULT cache. Instead, create additional caches and assign tables with ALTER TABLE ... KEY_BLOCK_SIZE or CACHE INDEX statements.
The administrative script explicitly runs DROP KEY_CACHE default; triggering the warning.
A rename attempt on the DEFAULT cache internally implies a drop, causing the same warning.
Schema migration generators may create DROP statements for all caches, including DEFAULT, when recreating caches across environments.
The intended custom cache name is mistyped as DEFAULT, inadvertently referencing the built-in cache.
Triggered when referencing a key cache name that has not been created.
Occurs if you attempt to create a key cache with a name that already exists.
Unrelated but often seen in the same migration scripts that touch storage attributes.
Appears if the engine fails to allocate resources, sometimes due to misconfigured key caches.
The server continues running, but leaving the warning clutters logs and hides real issues. Remove the offending statement.
Yes. If any MyISAM table is not assigned to another cache, DEFAULT must exist.
Use ALTER KEY_CACHE default PARAMETERS to adjust size, but do not drop it.
No. InnoDB ignores key caches. The warning only matters for MyISAM tables.