主键定义索引长度错误


问题描述

创建数据库的时候,主键指定长度导致错误。

#1089 - Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys

解决方法

修改 PRIMARY KEY (`id`(10))PRIMARY KEY (`id`) 即可。

因为主键不能指定索引长度。


参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录