4099
MySQLWARNINGCriticalHIGH confidence
TIMESTAMP column has a deprecated default value
Production Risk
Low — Current functionality is maintained, but schema compatibility will degrade in future versions.
Why it happens
- 1A TIMESTAMP column implicitly uses the deprecated zero-value default.
- 2The schema was created under a different sql_mode that permitted implicit defaults.
Fix
Specify an explicit DEFAULT for TIMESTAMP columns
Specify an explicit DEFAULT for TIMESTAMP columns
ALTER TABLE t MODIFY col TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
Why this works
An explicit default removes ambiguity and ensures forward compatibility.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 4099 ER_WARN_DEPRECATED_WRONG_TIMESTAMP_DEFAULT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev