慕哥,为什么我在建立微信账号表的openId唯一索引的时候,显示[Err] 1071 - Specified key was too long; max key length is 767 bytes啊。我字段是varchar(1024),引擎是innodb,mysql5.5,数据库表设置和你一致就是alter加索引的时候报错。怎么解决啊
create table `tb_wechat_auth`(
`wechat_auth_id` int(10) not null auto_increment,
`user_id` int(10) not null,
`open_id` varchar(1024) not null,
`create_time` datetime default null,
primary key (`wechat_auth_id`),
constraint `fk_wechatauth_profile` foreign key(`user_id`) references `tb_person_info`(`user_id`)
)engine =INNODB auto_increment=1 default charset = utf8;
~
alter table tb_wechat_auth add unique index(open_id);
~
[SQL]alter table tb_wechat_auth add unique index(open_id);
[Err] 1071 - Specified key was too long; max key length is 767 bytes
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程