gpt4 book ai didi

mysql - SQL 错误 : Row size too large for VARCHAR(20)

转载 作者:行者123 更新时间:2023-11-30 21:33:38 25 4
gpt4 key购买 nike

我正在尝试创建一个名为“brand_slug”的列,类型为 VARCHAR(20),可为空,排序规则为“utf8mb4_unicode_ci”,但出现错误:

SQL Error: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.

奇怪的是,对于某些 VARCHAR 列,它允许我将它们设置为最多 255 个,而对于其他列,则最多只能设置 50 或 75 个,在这种情况下甚至不是表格。所有这些都发生在同一张表中。

我正在使用 InnoDB 引擎。

最佳答案

InnoDB 表的解决方案通常是更改行格式:

ALTER TABLE mytable ROW_FORMAT=DYNAMIC;

行的大小仍然有限,但可以将更多的 VARCHAR/BLOB/TEXT 列放入行中。

在执行此操作之前,您必须使以下 MySQL 选项生效:

innodb_file_format = Barracuda
innodb_file_per_table = ON

有关更多信息,请阅读文档:

关于mysql - SQL 错误 : Row size too large for VARCHAR(20),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55024624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com