mysql in 截断_MySQL文本列被截断

bd96500e110b49cbb3cd949968f18be7.png

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

Name: info

Type: text

Collation: utf8_general_ci

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 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.

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.

解决方案

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.

Ah, and make sure to check your max_allowed_packet size.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值