gpt4 book ai didi

mysql - 列的数据被截断

转载 作者:可可西里 更新时间:2023-11-01 08:03:37 25 4
gpt4 key购买 nike

你好,我尝试从 phpmyadmin 中插入数据到我的表中,但我遇到了这样的错误

1 row affected. Warning: #1265 Data truncated for column 'value' at row 1

我的桌面是这样的

    CREATE TABLE IF NOT EXISTS `setting` (
`setting_id` int(11) NOT NULL,
`store_id` int(11) NOT NULL DEFAULT '0',
`group` varchar(32) COLLATE utf8_bin NOT NULL,
`key` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`value` text COLLATE utf8_bin NOT NULL,
`serialized` tinyint(1) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=28279 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

我尝试放入大约 5000 个数据,当我尝试插入它时,我可以在它之后输入大约 2000 个数据,说错误数据截断谢谢。

最佳答案

列的数据被截断显然意味着您的数据太宽而无法放入指定的列中。它用于 value 字段,类型为 text文本字段只能容纳 65K 的数据。你需要一个更大的类型。也许 MEDIUMTEXT 可以容纳 16MB 的数据。

顺便说一句,因为您实际上是在列中存储二进制数据。 MEDIUMBLOB 实际上可能是更好的选择。

最后但同样重要的是:

http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-optimization-tips.html

With Web servers, store images and other binary assets as files, with the path name stored in the database rather than the file itself. Most Web servers are better at caching files than database contents, so using files is generally faster. (Although you must handle backups and storage issues yourself in this case.)

关于mysql - 列的数据被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40519633/

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