作者:tomodachitch | 来源:互联网 | 2023-09-05 11:26
您好,我尝试从phpmyadmin插入数据到我的桌子上,但是出现了这样的错误1rowaffected.Warning:#1265Datatruncatedforcolumn
您好,我尝试从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个数据.
解决方法:
列的数据被截断显然意味着您的数据太宽而无法容纳指定的列.它用于值字段,类型为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.)