Indexing a MySql TEXT column?

Solution 1:

You can't have a UNIQUE index on a text column in MySQL.

If you want to index on a TEXT or a BLOB field, you must specify a fixed length to do that.

From MySQL documentation:

BLOB and TEXT columns also can be indexed, but a prefix length must be given.

Example:

CREATE UNIQUE INDEX index_name ON misc_info (key(10));

Solution 2:

Two things:

  1. Key is a reserved word.
  2. You have to specify a length for a UNIQUE(key) TEXT value.

Solution 3:

I think it chokes on the key field name rather than the TEXT type (which should be perfectly fine).

Reserved Words in mySQL

(And as @Pablo already said, memo fields can't be unique.)