Invalid default value
❌ Error
Invalid default value for 'xyz'
📍 Context
This happens when a column has an unsupported or invalid default value (e.g., using 0000-00-00
for a DATE
column in strict mode).
✅ Solution
- Update the default value to a valid one:
ALTER TABLE table_name ALTER COLUMN xyz SET DEFAULT CURRENT_TIMESTAMP;
- Or remove the default value:
ALTER TABLE table_name ALTER COLUMN xyz DROP DEFAULT;
- Adjust MySQL strict mode settings if necessary.
ℹ️ Additional Information
- MySQL strict mode enforces stricter validation for defaults.
- Recommended to use valid and consistent defaults for better compatibility.