使用带有MYISAM的utf8mb4_general_ci指定键太长

时间:2016-07-29 12:34:52

标签: mysql utf-8 mariadb collation myisam

我可以使用归类utf8_general_ci创建一个表,但它会因归类utf8mb4_general_ci而失败 - 抛出错误:

  

#1071 - 指定的密钥太长;最大密钥长度为1000字节

以下是两个MySQL查询 - 除了COLLATION之外它们是相同的。第一个工作,第二个抛出上面的1071错误:

CREATE TABLE tng_addresses (
    addressID INT(11) NOT NULL AUTO_INCREMENT,
    address1 VARCHAR(64) NOT NULL,
    address2 VARCHAR(64) NOT NULL,
    city VARCHAR(64) NOT NULL,
    state VARCHAR(64) NOT NULL,
    zip VARCHAR(10) NOT NULL,
    country VARCHAR(64) NOT NULL,
    www VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    phone VARCHAR(30) NOT NULL,
    gedcom VARCHAR(20) NOT NULL,
    PRIMARY KEY (addressID),
    INDEX address (gedcom, country, state, city, address1)
) ENGINE = MYISAM COLLATE utf8_general_ci

这失败了:

CREATE TABLE tng_addresses (
    addressID INT(11) NOT NULL AUTO_INCREMENT,
    address1 VARCHAR(64) NOT NULL,
    address2 VARCHAR(64) NOT NULL,
    city VARCHAR(64) NOT NULL,
    state VARCHAR(64) NOT NULL,
    zip VARCHAR(10) NOT NULL,
    country VARCHAR(64) NOT NULL,
    www VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    phone VARCHAR(30) NOT NULL,
    gedcom VARCHAR(20) NOT NULL,
    PRIMARY KEY (addressID),
    INDEX address (gedcom, country, state, city, address1)
) ENGINE = MYISAM COLLATE utf8mb4_general_ci

唯一的区别是整理。关于为什么的任何想法?

系统信息:
Apache版本:2.4.17(Win32)OpenSSL / 1.0.2d PHP / 5.6.19
PHP版本:5.6.19
mySQL版本:5.5.5-10.1.10-MariaDB

0 个答案:

没有答案