mysql - SQL Error #1071 - Specified key was too long; max key length is 767 bytes -


create table wp_locations (         `id` int(11) not null auto_increment,         `city` varchar(255) not null,         `name` varchar(255) not null,         constraint `city_name` unique (`city`, `name`)     ) default character set utf8mb4 collate utf8mb4_unicode_ci; 

i got sql error '#1071 - specified key long; max key length 767 bytes'

what doing wrong?

mysql reserves max amount utf8 field 4 bytes 255 + 255 default character set utf8mb4 collate utf8mb4_unicode_ci; on 767 max key length limit

you can reduce single varchar lenght or don't use composite key


Comments

Popular posts from this blog

Formatting string according to pattern without regex in php -

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -