PHP和MYSQL最大变长? [英] PHP and MYSQL maximum variable length?

查看:120
本文介绍了PHP和MYSQL最大变长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图对一个mysql数据库执行INSERT,并且当任何值超过898个字符时,它会失败。有什么地方可以得到,或者更好,设置这个最大值?我会把字符串分成块和存储在不同的行,如果我必须,但我想能够插入高达2k一次。

I'm trying to do an INSERT into a mysql db and it fails when any of the values are longer than 898 characters. Is there somewhere to get or, better, set this maximum value? I'll hack the string into chunks and store 'em in separate rows if I must, but I'd like to be able to insert up to 2k at a time.

我猜这是PHP的问题,因为使用LONGTEXT或BLOB字段应该在db中有足够的空间。

I'm guessing this is php issue as using LONGTEXT or BLOB fields should be more than enough space in the db.

谢谢。

推荐答案

侧面注意

和文本列,您需要注意MySQL max_allowed_pa​​cket 变量。我相信它默认至少为1M。

When you get into working with large blobs and text columns, you need to watch out for the MySQL max_allowed_packet variable. I believe it defaults to at least 1M.

这篇关于PHP和MYSQL最大变长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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