mysql错误码1709_MySQL5.6出现ERROR 1709 (HY000): Index column size too large问题的解决方法...
一、問題
mysql 5.6 出現如下問題:
[ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.]
二、解決
根據文檔所述
Prefix support and lengths of prefixes (where supported) are storage engine dependent. For example, a prefix can be up to 767 bytes long for?InnoDB?tables or 3072 bytes if the?innodb_large_prefix?option is enabled. For?MyISAM?tables, the prefix length limit is 1000 bytes.
innodb_large_prefix
根據以上可知,如果需要在長度大于255字符的字段上創建索引,需要修改以下3個參數
2.?innodb_file_per_table=true
3.?ROW_FORMAT=DYNAMIC or COMPRESSED
更改參數:
mysql> set global innodb_file_format = BARRACUDA;
mysql> set global innodb_large_prefix = ON;
在創建表時,需要 加 ROW_FORMAT=DYNAMIC 參數:
create table raw_log_meta_data(
id bigint NOT NULL AUTO_INCREMENT,
app_id varchar(64),
user_id varchar(128),
file_path varchar(512),
device_id varchar(128),
update_time DATETIME,
PRIMARY KEY (id),
UNIQUE KEY (user_id),
UNIQUE KEY (file_path)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.29 sec)
作者:Corwien
總結
以上是生活随笔為你收集整理的mysql错误码1709_MySQL5.6出现ERROR 1709 (HY000): Index column size too large问题的解决方法...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 二项分布的期望方差证明_关于二项分布
- 下一篇: Eclipse配置自动补齐键为alt+/