为什么我的 MySQL 数据列中只保存了 64kB 数据?

发布于 2024-07-10 18:15:48 字数 210 浏览 6 评论 0原文

我试图将一个很长的文本字符串插入到 MySQL Blob 列中,但 MySQL 只保存了 64kB 的数据。 该字符串的长度为 75360 个字符。 我正在使用 PHP 的 mysql_connect() 连接。

有任何想法吗?

它是 Blob 还是 Text 有区别吗? 我最初将其作为文本,但对其进行了更改,但没有任何影响。

I am trying to insert a very long text string into a MySQL Blob column, but MySQL is only saving 64kB of the data. The string is 75360 characters long. I am connecting with PHP's mysql_connect().

Any ideas?

Does it make a difference if it's Blob or Text. I originally had it as a Text but changed it with no affect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

高冷爸爸 2024-07-17 18:15:48

因为这是 BLOB 列的最大大小。 您需要使用 MEDIUMBLOB/LONGBLOB 或 MEDIUMTEXT/LONGTEXT。

Because that's the maximum size of a BLOB column. You need to use MEDIUMBLOB/LONGBLOB or MEDIUMTEXT/LONGTEXT.

书信已泛黄 2024-07-17 18:15:48

MySQL 中的 BLOB 类型最多可以存储 65,534 字节,如果您尝试存储超过这么多的数据,MySQL 将截断数据。 MEDIUMBLOB 最多可存储 16,777,213 字节,LONGBLOB 最多可存储 4,294,967,292 字节。

如果启用严格 SQL 模式(MySQL 模式 )当您尝试存储不适合列类型的数据时,您将收到错误。

A BLOB type in MySQL can store up to 65,534 bytes, if you try to store more than this much data MySQL will truncate the data. MEDIUMBLOB can store up to 16,777,213 bytes, and LONGBLOB can store up to 4,294,967,292 bytes.

If you enable strict SQL mode (MySQL modes) you will get an error when you try to store data that doesn't fit in the column type.

白日梦 2024-07-17 18:15:48

您还问BLOB和TEXT之间是否有区别
BLOBS 用于二进制数据。 如果对 BLOB 字段执行 LIKE 查询,它将区分大小写。

IE

SELECT 'TEXT' LIKE 'TEXT';
=> 1 for both BLOB and TEXT

SELECT 'TEXT' LIKE 'text';
=> 1 for TEXT
=> 0 for BLOB

You also asked if there is a difference between BLOB and TEXT
BLOBS are for binary data. If you do a LIKE query on a BLOB field it will be case sensitive.

i.e.

SELECT 'TEXT' LIKE 'TEXT';
=> 1 for both BLOB and TEXT

SELECT 'TEXT' LIKE 'text';
=> 1 for TEXT
=> 0 for BLOB
岁月流歌 2024-07-17 18:15:48

每个 文档 中的 blob 列只有

64Kb改为 Mediumblob 列类型...

The blob column is only 64Kb per the documentation

Try a mediumblob column type instead...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文