Common SQL Errors

MySQL Error 1101: ER_BLOB_CANT_HAVE_DEFAULT – How to Fix and Prevent

Galaxy Team
August 5, 2025

MySQL raises error 1101 when a CREATE or ALTER statement assigns a DEFAULT value to a BLOB, TEXT, GEOMETRY, or JSON column, which those types cannot have.

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 1101 ER_BLOB_CANT_HAVE_DEFAULT?

MySQL Error 1101: ER_BLOB_CANT_HAVE_DEFAULT occurs when a CREATE or ALTER TABLE statement tries to set a default value on a BLOB, TEXT, GEOMETRY, or JSON column. Remove the DEFAULT clause or use a compatible data type to fix the issue.

Error Highlights

Typical Error Message

BLOB, TEXT, GEOMETRY or JSON column '%s' can't have a

Error Type

Schema Definition Error

Language

MySQL

Symbol

ER_BLOB_CANT_HAVE_DEFAULT

Error Code

1101

SQL State

Explanation

Table of Contents

What is MySQL Error 1101 ER_BLOB_CANT_HAVE_DEFAULT?

The exact message is: BLOB, TEXT, GEOMETRY or JSON column '%s' can't have a default value. MySQL throws it while parsing a CREATE TABLE or ALTER TABLE statement.

The server blocks DEFAULT on these large object types because their size and storage characteristics make implicit initialization unsafe.

Before MySQL 8.0.13, even expression defaults were disallowed, so the error commonly appears on older versions.

What Causes This Error?

Assigning a literal DEFAULT ('') or DEFAULT 0 to any column defined as BLOB, TEXT, JSON, or GEOMETRY immediately triggers the error.

Running a migration file generated by ORMs that assume all NOT NULL columns need DEFAULT values often leads to the problem.

Upgrading schemas from other databases where LOB columns allow defaults can introduce incompatible DDL into MySQL.

How to Fix MySQL Error 1101 ER_BLOB_CANT_HAVE_DEFAULT

Remove the DEFAULT clause from the problematic column and re-run the DDL.

MySQL automatically sets such columns to NULL unless you supply data during INSERT.

If you must auto-populate the column, create a BEFORE INSERT trigger or switch to VARBINARY or VARCHAR with an explicit length that supports defaults.

Common Scenarios and Solutions

CI/CD pipelines fail because an ORM adds DEFAULT '' to longtext fields. Configure the ORM to skip defaults for BLOB/TEXT types.

A migration converts VARCHAR(255) to TEXT DEFAULT ''.

Split the step: first drop DEFAULT, then change the data type.

Developers on MySQL 8.0.19 try DEFAULT (CONVERT('{}' AS JSON)) for JSON columns.

Ensure sql_mode includes ALLOW_INVALID_DATES and use DEFAULT (json_object()) instead.

Best Practices to Avoid This Error

Define BLOB/TEXT/JSON columns as NULLABLE unless application logic guarantees a value at insert time.

Use generated columns or triggers instead of DEFAULT values when you need automatic initialization of LOB data.

Related Errors and Solutions

Error 1108 ER_WRONG_FIELD_SPEC occurs when DEFAULT is placed before the column definition.

Move DEFAULT after the data type.

Error 1067 Invalid default value arises when DATE or TIMESTAMP defaults are not literal constants. Ensure the default follows MySQL rules.

.

Common Causes

Related Errors

FAQs

Can I ever set a default for a BLOB or TEXT column in MySQL?

No. The MySQL storage engine disallows literal defaults for BLOB and TEXT types. Use triggers or generated columns instead.

Does MySQL 8.0 support default expressions on JSON columns?

Yes, starting with 8.0.13 you can use DEFAULT (expression) for JSON, but literal defaults still raise the error.

Why does my migration work locally but fail in CI?

Your local MySQL version may allow expression defaults while CI runs an older release. Align server versions or remove the DEFAULT clause.

How does Galaxy help avoid this error?

Galaxy's context-aware AI copilot flags illegal DEFAULT clauses in real time and suggests compliant DDL, preventing failed deployments.

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