mysql 主键(唯一索引)长度限制为767字节
(2015-07-05 14:47:39)
标签:
mysql |
分类: linux |
Specified key was too long; max key length is 767 bytes
database: MySQL 5.5.27
[SQL] create table School (id bigint not null auto_increment, address varchar(255) not null, code varchar(255) not null, contacter varchar(255) not null, createDate datetime, homePage longtext, name varchar(255) not null, phone varchar(255) not null, type varchar(255) not null, updateDate datetime, examOffice_id bigint, primary key (id), unique (name))
[Err] 1071 - Specified key was too long; max key length is 767 bytes
解决办法:
1- 将数据库的字符集更改为utf-8
1- 将数据库的字符集更改为utf-8
2 - 将主键字段的长度修改为191以内