TINYTEXT、TEXT、MEDIUMTEXT 和 LONGTEXT 最大存储大小 [英] TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT maximum storage sizes

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

问题描述

根据 MySQL 文档,有四种 TEXT 类型:

  1. TINYTEXT
  2. 文本
  3. 中文本
  4. 长文本

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

解决方案

来自 文档 (MySQL 8) :

<前>类型 |最大长度-----------+------------------------------------小文字 |255 (2 8−1) 字节正文 |65,535 (216−1) 字节 = 64 KiB中文本 |16,777,215 (224−1) 字节 = 16 MiB长文 |4,294,967,295 (232−1) 字节 = 4 GiB

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

Per the MySQL docs, there are four TEXT types:

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

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

解决方案

From the documentation (MySQL 8) :

      Type | Maximum length
-----------+-------------------------------------
  TINYTEXT |           255 (2 8−1) bytes
      TEXT |        65,535 (216−1) bytes = 64 KiB
MEDIUMTEXT |    16,777,215 (224−1) bytes = 16 MiB
  LONGTEXT | 4,294,967,295 (232−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 最大存储大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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