4098
MySQLWARNINGCriticalHIGH confidence

TIMESTAMP with DEFAULT NULL is deprecated

Production Risk

Low — Current behavior is preserved, but schema may break in future MySQL versions.

Why it happens
  1. 1A TIMESTAMP column was defined without an explicit DEFAULT value and NULL was assigned by the server.
  2. 2Older schema definitions that relied on implicit TIMESTAMP defaults are being used.

Fix

Explicitly define the DEFAULT for TIMESTAMP columns

Explicitly define the DEFAULT for TIMESTAMP columns
ALTER TABLE t MODIFY col TIMESTAMP NULL DEFAULT NULL;

Why this works

Make the NULL default explicit to silence the warning and prepare for future compatibility.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 4098 ER_WARN_DEPRECATED_TIMESTAMP_DEFAULT_NULL

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors