#1089 –不正确的前缀密钥

时间:2020-03-04 05:15:22

标签: mysql

不确定我丢失了什么...试图导入DB并显示错误消息:

“在第594行的错误1089(HY000):不正确的前缀密钥;使用的密钥部分不是字符串,使用的长度比密钥部分长,或者存储引擎不支持唯一的前缀密钥”:

DROP TABLE IF EXISTS `block_content__field_three_wide_header`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `block_content__field_three_wide_header` (
  `bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
  `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted',
  `entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to',
  `revision_id` int(10) unsigned NOT NULL COMMENT 'The entity revision id this data is attached to',
  `langcode` varchar(32) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The language code for this data item.',
  `delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
  `field_three_wide_header_value` varchar(5) NOT NULL,
  `field_three_wide_header_format` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`entity_id`,`deleted`,`delta`,`langcode`),
  KEY `bundle` (`bundle`),
  KEY `revision_id` (`revision_id`),
  KEY `field_three_wide_header_format` (`field_three_wide_header_format`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Data storage for block_content field field_three_wide…';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `block_content__field_three_wide_header`
--

1 个答案:

答案 0 :(得分:0)

您正在为 key field_three_wide_header_format`(191)使用无效的长度。同时声明您使用长度5,但在密钥中使用191会造成问题。使用

KEY `field_three_wide_header_format` (`field_three_wide_header_format`(5))

DEMO