mysql - My SQL Script erro 1071 - Does Not Work ADD UNIQUE or Change ENGINE -


  `create table if not exists `odin`.`usuario` (   `codusuario` int not null auto_increment,   `codtipousuario` int not null,   `codconsultortecnico` int null,   `codprodutor` int null,   `login` varchar(255) character set 'utf8mb4' not null,   `senha` varchar(32) character set 'utf8mb4' not null,   `ativo` tinyint(1) not null,   `maiordataregistrada` datetime not null,   `datalimite` datetime not null default '01/01/2014',   `maxfazendas` int not null default 0,   `maxfemeas` int not null default 0,   `coduserweb` int not null default 0,   `codestudante` int null,   `ultimobackup` datetime null,   primary key (`codusuario`),   unique index `uq__usuario__00000000000006d8` (`login` asc),   constraint `fk_usu_ref_est`     foreign key (`codestudante`)     references `odin`.`estudante` (`codestudante`)     on delete no action     on update no action,   constraint `fk_usuario_ref_consultor`     foreign key (`codconsultortecnico`)     references `odin`.`consultortecnico` (`codconsultortecnico`)     on delete no action     on update no action,   constraint `fk_usuario_ref_produtor`     foreign key (`codprodutor`)     references `odin`.`produtor` (`codprodutor`)     on delete no action     on update no action,   constraint `fk_usuario_ref_tipousuario`     foreign key (`codtipousuario`)     references `odin`.`conftipousuario` (`codtipousuario`)     on delete no action     on update no action) ` 

i've tried solutions such as: engine=innodb default charset=utf8 collate=utf8_unicode_ci; or engine=innodb default charset=utf16 collate=utf8_unicode_ci;

or add unique

and still continue error:

1071 - specified key long; max key length 767 bytes

can me? thank you

you using utf8mb4 1-4 bytes per character.

you chose varchar(255) - 255 characters * 4 bytes = 1020.

try less characters. varchar(191).

also have innodb_large_prefix.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -