MySQL error: key specification without a key length

前端 未结 16 1127
别跟我提以往
别跟我提以往 2020-11-22 08:41

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn\'t enough. I tried changing the field to a text, but I get the foll

16条回答
  •  攒了一身酷
    2020-11-22 09:06

    alter table authors ADD UNIQUE(name_first(767), name_second(767));
    

    NOTE : 767 is the number of characters limit upto which MySQL will index columns while dealing with blob/text indexes

    Ref : http://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html

提交回复
热议问题