Common SQL Errors

MySQL Error 1067: ER_INVALID_DEFAULT – Invalid default value explained and fixed

Galaxy Team
August 5, 2025

MySQL raises error 1067 (ER_INVALID_DEFAULT) when a column definition contains a default value that conflicts with its data type, constraints, or SQL mode settings.

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 1067 invalid default value?

MySQL Error 1067: ER_INVALID_DEFAULT occurs when a column’s DEFAULT clause is incompatible with its data type or the server’s SQL mode. Check the column type, remove or correct the DEFAULT value, and re-run the ALTER or CREATE statement to resolve the issue.

Error Highlights

Typical Error Message

Invalid default value for '%s'

Error Type

Schema Definition Error

Language

MySQL

Symbol

ER_INVALID_DEFAULT

Error Code

1067

SQL State

Explanation

Table of Contents

What is MySQL Error 1067 (ER_INVALID_DEFAULT)?

MySQL throws "Error 1067: Invalid default value for 'column'" while executing CREATE TABLE or ALTER TABLE statements. The server rejects the column definition because its DEFAULT clause violates data-type rules or active SQL modes such as STRICT or NO_ZERO_DATE.

This schema definition error stops table creation or modification, blocking deployments and migrations.

Resolving it quickly keeps CI pipelines and applications healthy.

What Causes This Error?

The error fires when MySQL detects a mismatch between the declared data type and the supplied default.

STRICT mode tightens checks, so formerly accepted defaults may now fail.

Typical triggers include invalid date strings, zero dates under NO_ZERO_DATE, non-numeric strings in numeric columns, functions not allowed as defaults before MySQL 8.0, and mismatched length or collation settings.

How to Fix MySQL Error 1067: ER_INVALID_DEFAULT

Identify the offending column in the server output.

Verify its data type and NULL policy, then supply a literal value that conforms to both or drop the DEFAULT clause entirely.

For date columns, replace "0000-00-00" with a real date like "1970-01-01" or allow NULL. For TIMESTAMP or DATETIME in MySQL 8.0+, use CURRENT_TIMESTAMP if permitted.

Common Scenarios and Solutions

Auto-increment primary keys should not carry a default. Remove DEFAULT from INT AUTO_INCREMENT columns.

VARCHAR columns cannot default to values longer than their declared length.

Adjust the length or shorten the default string.

Best Practices to Avoid This Error

Always test DDL in a development clone running the same SQL modes as production.

Use CHECK constraints or domain tables for validated defaults.

Galaxy’s schema-aware autocomplete flags invalid DEFAULT clauses while you type, preventing commits that would fail in CI.

Related Errors and Solutions

Error 1293 (HY000) - Incorrect table definition can appear when foreign key defaults misalign.

Error 1366 (22007) - Incorrect string value may accompany invalid default character data. Fixing the default often resolves both.

.

Common Causes

Related Errors

FAQs

Can I disable strict default checks permanently?

You can remove STRICT modes from sql_mode in my.cnf, but this risks data quality. Prefer fixing schema definitions.

Are expressions allowed as DEFAULT in MySQL 8.0?

Yes. MySQL 8.0 lets you use expressions like CURRENT_TIMESTAMP or JSON_OBJECT() as defaults under certain rules.

Why does Galaxy flag this error before MySQL does?

Galaxy’s parser knows SQL modes and column metadata, so it warns about incompatible defaults as you type, saving round-trips.

Will modifying the default rebuild the entire table?

Depending on storage engine and MySQL version, some ALTER statements perform in-place changes while others copy the table. Check EXPLAIN ALTER output.

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