MySQL文本列被截断 [英] MySQL Text Column being truncated

查看:635
本文介绍了MySQL文本列被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MySQL数据库,其中将大量文本信息存储到数据库的Text字段中.列是

I have a MySQL database in which I am storing a bunch of textual info into a Text field in the database. The columns is

名称:info
类型:文字
整理:utf8_general_ci

Name: info
Type: text
Collation: utf8_general_ci

我有一个用户在该字段中插入〜64kb的信息,但它吓坏了.它将截断最后3个字符.在这种情况下,这恰好是选项卡的结尾,因此它将页面上的所有内容搞乱了.如果我手动进入数据库并删除几个字母并添加后缀,则下次我对其进行编辑时,最后三个字母将被再次删除.

I had a user insert ~64kb of information into the field and it freaks out. It will truncate the last 3 characters off. Which in this case happen to be the ending to a tab so it screws up everything after it on the page. If I manually go into the database and remove a couple letters and add the back then next time I go to edit it those last 3 will be removed again.

phpmyadmin指出该字段太长,可能无法编辑.因此,我尝试在cms页面上对其进行编辑,但仍然收到相同的结果.

phpmyadmin is stating that the field is to long and may not be editable. So I tried to edit it on my cms page and I still recieved the same result.

在mysql的单个数据库文本列中有这么多数据是否存在任何已知问题?似乎不应该存在.

Are there any known problems with this much data in a single database text column in mysql? It does not seems like there should be.

推荐答案

我认为MySQL TEXT字段的最大大小小于2 ^ 16字节.使用UTF-8编码,这意味着更少的字符.您可以将MEDIUMTEXT用作2 ^ 24字节,或者将LONGTEXT用作2 ^ 32字节,请参见 MySQL文档了解详情.

I think the max size of a MySQL TEXT field is smaller than 2^16 bytes. Using UTF-8 encoding, this can mean even less characters. You could use MEDIUMTEXT for 2^24 or LONGTEXT for 2^32 bytes instead, see the MySQL-Docs for details.

啊,请确保检查您的 max_allowed_packet 大小.

Ah, and make sure to check your max_allowed_packet size.

这篇关于MySQL文本列被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆