Menu

MySQL TINYTEXT: 255-Byte Text Limit

Updated on

MySQL TINYTEXT stores nonbinary text in up to 255 bytes. That allows up to 255 single-byte characters; fewer characters fit when the chosen character set encodes them using multiple bytes. The type uses a one-byte length prefix. See MySQL’s string type syntax and BLOB and TEXT reference.

Define a TINYTEXT column

CREATE TABLE short_notes (
    note_id INT PRIMARY KEY,
    note_text TINYTEXT NOT NULL
);

Use TINYTEXT only if its byte capacity fits the valid content. For short values, VARCHAR is often a clearer choice: VARCHAR has an explicit character limit and can have a default, whereas TEXT family columns cannot have DEFAULT values. For a larger text limit, compare TEXT, MEDIUMTEXT, and LONGTEXT.

The largest value a client can transfer is also limited by available memory and communication buffers, including the client and server max_allowed_packet settings. If data exceeds the type limit, strict SQL mode rejects nonspace truncation; without strict mode, MySQL can truncate the value and issue a warning.

Advertisement