Home > Database > Mysql Tutorial > What are the Maximum Storage Limits for MySQL TEXT Data Types in UTF-8 Encoding?

What are the Maximum Storage Limits for MySQL TEXT Data Types in UTF-8 Encoding?

Barbara Streisand
Release: 2024-12-06 03:05:13
Original
738 people have browsed it

What are the Maximum Storage Limits for MySQL TEXT Data Types in UTF-8 Encoding?

MySQL TEXT Data Types: Maximum Storage Limits for UTF-8

MySQL offers four TEXT data types: TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. Each type has a specific maximum storage capacity for textual data.

Assuming the character encoding is UTF-8, the maximum storage lengths for each TEXT data type are as follows:

  • TINYTEXT: 255 bytes
  • TEXT: 65,535 bytes (64 KiB)
  • MEDIUMTEXT: 16,777,215 bytes (16 MiB)
  • LONGTEXT: 4,294,967,295 bytes (4 GiB)

It's important to note that the number of characters that can be stored in a column depends on the character encoding. UTF-8, for instance, requires one byte per character for English text and one or more bytes per character for non-English text.

The choice of TEXT data type should be based on the expected maximum length of the text data to be stored. TINYTEXT is suitable for short strings, while LONGTEXT can accommodate up to 4 GiB of text data.

The above is the detailed content of What are the Maximum Storage Limits for MySQL TEXT Data Types in UTF-8 Encoding?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template