Error
Error Code:
1170
MariaDB Error 1170: Missing Key Length for BLOB/TEXT
Description
This error indicates that you are attempting to create an index on a BLOB or TEXT column without specifying a prefix length. MariaDB requires a prefix length for indexes on these data types because they can store very large, variable-length data, making full-column indexing inefficient or impossible. It commonly occurs during `CREATE TABLE` or `ALTER TABLE` operations.
Error Message
BLOB/TEXT column '%s' used in key specification without a key length
Known Causes
3 known causesDirect BLOB/TEXT Indexing
An index was defined directly on a BLOB or TEXT column without explicitly providing a prefix length for the index.
Omitted Length in DDL
The required key length was accidentally left out when defining the index in a `CREATE TABLE` or `ALTER TABLE` statement.
ORM/Tool Misconfiguration
Schema generation tools or ORMs may not automatically include the necessary key length when creating indexes on BLOB/TEXT columns.
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