Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Error Code: 1071. Specified key was too long

Shulou Source: shulou.com Published: 2022-06-03 08:14:50 10月05日 Update

Error message

Error Code: 1071. Specified key was too long; max key length is 767 bytes

Table structure

CREATE TABLE yundou_data_ system.`object _ event` (`id`object (11) unsigned NOT NULL AUTO_INCREMENT, `object_ id`int (11) unsigned NOT NULL DEFAULT '0events, `event_ name` varchar (256C) NOT NULL DEFAULT'', `create_ time`int (11) unsigned NOT NULL DEFAULT '0questions, `status` tinyint (1) unsigned NOT NULL DEFAULT' 1records, PRIMARY KEY (`id`), UNIQUE KEY `unq_event_ name` (`event_ name`), KEY `idx_object_ id` (`object_ id`) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=' object event table'

Reason

Mysql's varchar primary key only supports fields of no more than 767 bytes or 768 bytes, 384 bytes, or 767 bytes, while GBK is double-byte and UTF8 is three-byte.

Solution

`event_ name`varchar (255) NOT NULL DEFAULT''

Tags: Bytes events information reasons fields objects schemes structures solutions errors support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Redmi Shulou Information Linux vpn