本文介绍了TINYTEXT,TEXT,MEDIUMTEXT和LONGTEXT的最大存储大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个 MySQL文档,共有四种TEXT类型:

Per the MySQL docs, there are four TEXT types:

  1. TINYTEXT
  2. TEXT
  3. MEDIUMTEXT
  4. LONGTEXT

假设字符编码为UTF-8,我可以在每种数据类型的列中存储的最大长度是多少?

What is the maximum length that I can store in a column of each data type assuming the character encoding is UTF-8?

推荐答案

来自文档:


      Type | Maximum length
-----------+-------------------------------------
  TINYTEXT |           255 (2−1) bytes
      TEXT |        65,535 (2−1) bytes = 64 KiB
MEDIUMTEXT |    16,777,215 (2−1) bytes = 16 MiB
  LONGTEXT | 4,294,967,295 (2−1) bytes =  4 GiB

请注意,可以在您的列中存储的字符的数量取决于字符编码.

Note that the number of characters that can be stored in your column will depend on the character encoding.

这篇关于TINYTEXT,TEXT,MEDIUMTEXT和LONGTEXT的最大存储大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 09:54