- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我只是在虚拟机上安装了 debian 8.3 并在此之后安装了 xampp Tutorial .一切正常,直到我尝试创建一个新表:
create table testtable
(
id int(10) not null auto_increment,
firstname varchar(255) collate utf8mb4_german2_ci not null,
lastname varchar(255) collate utf8mb4_german2_ci not null,
primary key (id),
unique key (lastname)
)engine = innodb default charset=utf8mb4, collate=utf8mb4_german2_ci
我收到错误:#1709 - Index column size too large. The maximum column size is 767 bytes.
然后我发现这来自 prefix limitation
在 Innodb
中限制为 767Byte我可以通过在 my.cnf 文件中设置 innodb_large_prefix 来解决这个问题。但是我找不到文件,它不在 /etc/
下并且没有 /etc/mysql/
-文件夹,唯一my.cnf
我发现在 /opt/lampp/etc/
, 但是,在我添加了 innodb_large_prefix=1
之后到文件并重新启动lampp。我仍然遇到同样的错误。我做错了什么?
编辑:SELECT version()
返回 5.6.14
, 所以 innodb_large_prefix
应该支持。
edit2:我知道我可以通过仅将部分 key 设置为索引来解决此问题,使其小于 767 字节。但我想在这里知道如何正确配置 mysql。
最佳答案
在 5.6.3 和 5.7.7 之间(即如果您运行的是 MySQL 5.6 或 MariaDB 10.0),有 4 个步骤:
注意
SELECT * FROM information_schema.INNODB_SYS_TABLESPACES;
将提供 file_format 和 row_format。其他一些 I_S 表提供了 file_per_table 的线索。
关于mysql 更改 innodb_large_prefix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847015/
我遇到了一些问题。 你看,我已经使用 WAMP 在本地创建了一个 WordPress 网站,一切似乎都工作正常,直到我尝试将 MySQL 数据库导入到新的实时网站时出现错误: “#1709 - 索引列
我只是在虚拟机上安装了 debian 8.3 并在此之后安装了 xampp Tutorial .一切正常,直到我尝试创建一个新表: create table testtable ( id int(
我在 Debian Linux 上运行 MySQL 5.5.55,我想启用 innodb_large_prefix 设置,这样我就可以拥有大于 767 字节的表索引。 我的/etc/mysql/my.
我是一名优秀的程序员,十分优秀!