首页 > 解决方案 > MySQL (1118, 'Row size too large (> 8126)) &增加 innodb_log_buffer 给我错误

问题描述

我在 Ubuntu 16.04 上运行临时服务器,

当我尝试保存特定文档时,出现以下错误:

OperationalError at /product/1172
(1118, 'Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.')

该文档包含许多文本字段,长度介于 10 到 1000 个字符之间。当我删除一些文本时,我实际上可以很好地保存文档。所以它可能是字符绑定的。

有趣的是,当我尝试将相同的文档详细信息克隆到我的本地 MYSQL 版本中时,它工作得很好。所以我的下一个合乎逻辑的步骤是比较innodb_全局变量。

我进行了比较,唯一不同的变量是innodb_log_buffer_size 本地设置为 16M,而暂存版本设置为 8M。所以我尝试从 [mysqld] 语句下的 mysql.conf 设置它。

但是,当我尝试重新启动 mysql 服务时,出现以下错误:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

在检查 error.log 文件时,我发现:


2019-08-07T05:42:54.144803Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2019-08-07T05:42:54.144847Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2019-08-07T05:42:54.302070Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please $
2019-08-07T05:42:54.303636Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.21-0ubuntu0.16.04.1) starting as p$
2019-08-07T05:42:54.308390Z 0 [Warning] InnoDB: innodb-page-size has been changed from the default v$
2019-08-07T05:42:54.308451Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-08-07T05:42:54.308460Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-08-07T05:42:54.308464Z 0 [Note] InnoDB: Uses event mutexes
2019-08-07T05:42:54.308468Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory $
2019-08-07T05:42:54.308472Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-08-07T05:42:54.308475Z 0 [Note] InnoDB: Using Linux native AIO
2019-08-07T05:42:54.308706Z 0 [Note] InnoDB: Number of pools: 1
2019-08-07T05:42:54.308808Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-08-07T05:42:54.310251Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances $
2019-08-07T05:42:54.315213Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-08-07T05:42:54.316859Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleane$
2019-08-07T05:42:54.327052Z 0 [ERROR] InnoDB: Data file './ibdata1' uses page size 16384, but the in$
2019-08-07T05:42:54.327079Z 0 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of da$
2019-08-07T05:42:54.327088Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-08-07T05:42:54.928006Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-08-07T05:42:54.928037Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-08-07T05:42:54.928043Z 0 [ERROR] Failed to initialize builtin plugins.
2019-08-07T05:42:54.928046Z 0 [ERROR] Aborting

2019-08-07T05:42:54.928061Z 0 [Note] Binlog end
2019-08-07T05:42:54.928415Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

我只在尝试添加innodb_log_buffer_size变量时出现此错误,而不是任何其他 innodb 变量。

原始的 OpretaionalError 是由较低的缓冲区变量引起的吗?如果是这样,我如何安全地将其更改为适当的范围?

Python:3.5.2 运行 Django

MYSQL:版本 14.14 Distrib 5.7.21,适用于 Linux (x86_64),使用 EditLine 包装器

服务器:Ubuntu 16.04 上的 Apache 2

标签: pythonmysqldjango

解决方案


多谢你们!

我设法通过更改以下 innodb_file_format = BARRACUDA innodb_large_prefix = 1 解决了这个问题

重新启动数据库

然后我不得不改变表 ALTER TABLE [表名] ENGINE=INNODB ROW_FORMAT = DYNAMIC;

然后它就像魔术一样工作!显然,上面的错误与我的问题无关,而是其他一些设置导致了它,阻碍了文件格式的更改和大前缀更改,正如@Solarflare 指出的那样!


推荐阅读