Your destination for complete Tech news

what is the Maximum length for MySQL type text?

373 0
< 1 min read

The maximum length for the TEXT data type in MySQL is 65535 characters. This is because TEXT data types are stored using a two-byte length prefix that indicates the number of characters in the value.

Here is a summary of the different TEXT data types in MySQL and their maximum lengths:

  • TINYTEXT: 255 characters
  • TEXT: 65535 characters
  • MEDIUMTEXT: 16777215 characters
  • LONGTEXT: 4,294,967,295 characters

Note that the actual maximum length of a TEXT value may be less than the theoretical maximum, depending on the character set and collation used for the column. For example, if you use the utf8mb4 character set, which supports four-byte characters, the maximum length for a TINYTEXT column will be reduced to 191 characters.

If you need to store longer strings, you can use the BLOB data type, which has a maximum length of 4,294,967,295 bytes.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.