TINYTEXT is the smallest of MySQL’s TEXT family (TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT). It can hold from 0 to 255 bytes, using a 1-byte length prefix that records the actual string length. Because storage is byte-based, the character limit varies with the column’s character set (e.g., up to 255 ASCII characters but fewer multibyte UTF-8 characters). TINYTEXT values are stored off-row, with only a pointer kept in the base table row, which can reduce row size but adds one extra lookup when reading. Unlike VARCHAR, a TINYTEXT column cannot have a default value other than NULL and cannot be indexed for its full length without specifying a prefix length. It obeys the current or declared CHARACTER SET and COLLATE rules, supports all standard string functions, and participates in BLOB/TEXT specific behaviors such as implicit temporary tables when used in GROUP BY or ORDER BY.
CHARACTER SET
(string) - Sets the character set for the columnCOLLATE
(string) - Sets the collation for the columnMySQL 3.23
TINYTEXT holds up to 255 bytes of data. With single-byte character sets this equals 255 characters, while multibyte sets reduce the character count.
Choose TINYTEXT if you need flexible, short free-text storage without default values and want to keep row size small via off-row storage. If you need default values or full-length indexing, VARCHAR is usually preferable.
Yes. Provide a prefix length in the index definition, such as CREATE INDEX idx_txt ON t(col(80)). MySQL cannot index the entire TINYTEXT field without a length.
It refers to bytes. In multibyte encodings like utf8mb4, the maximum character count can be less than 255 if any characters use more than one byte.