mysql键太长_MySQLVARCHAR(255)UTF8对于键太长,但
最⼤长度为1000字节
如果您使⽤utf8mb4,并且对varchar列的长度⼤于191个字符的唯⼀索引,则需要打开innodb_large_prefix以允许索引中的较⼤列,因为utf8mb4需要的存储空间⼤于utf8或latin1 。将以下内容添加到您的myf⽂件。
varchar2最大长度[mysqld]
innodb_file_format=barracuda
innodb_file_per_table=1
innodb_large_prefix=1
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
If innodb_large_prefix is enabled (the default in MySQL 5.7.7), the
index key prefix limit is 3072 bytes for InnoDB tables that use
DYNAMIC or COMPRESSED row format. If innodb_large_prefix is disabled,
the index key prefix limit is 767 bytes for tables of any row format.
innodb_large_prefix is deprecated in MySQL 5.7.7 and will be removed
in a future release. innodb_large_prefix was introduced in MySQL 5.5
to disable large index key prefixes for compatibility with earlier
versions of InnoDB that do not support large index key prefixes.
总⽽⾔之,限制只是为了兼容性,并将在未来的版本中增加。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论