Error
Error Code:
1101
MySQL Error 1101: Invalid Default for Large Column
Description
This error occurs when you attempt to define a column of type BLOB, TEXT, GEOMETRY, or JSON with an explicit DEFAULT value. MySQL's architecture does not permit default values for these large object data types, as their content can be substantial and variable. It typically arises during DDL operations like `CREATE TABLE` or `ALTER TABLE`.
Error Message
BLOB, TEXT, GEOMETRY or JSON column '%s' can't have a default value
Known Causes
4 known causesExplicit Default Value Assignment
The most common cause is directly specifying a `DEFAULT` clause for a BLOB, TEXT, GEOMETRY, or JSON column within a `CREATE TABLE` or `ALTER TABLE` statement.
ORM or Framework DDL Generation
Development frameworks or Object-Relational Mappers (ORMs) may inadvertently generate DDL statements that include `DEFAULT` clauses for these restricted data types during schema migrations or synchronization.
Schema Migration from Other DBs
When migrating a database schema from another system (e.g., PostgreSQL, SQL Server) that might allow default values for similar large object types, the unadjusted DDL can trigger this error in MySQL.
Misunderstanding Column Constraints
A lack of awareness regarding MySQL's specific limitations for large object types can lead to incorrectly including a `DEFAULT` clause where it is not supported.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service