Varchar in database (255)
MySQL | ver < 4.1: VARCHAR in bytes of storage, so suppose all for commonly used Chinese characters (utf-8
3 bytes encoding length), then VARCHAR(255) can store about 85 Chinese characters;
MySQL | ver > = 4.1:
VARCHAR is stored in character units. Assuming that the input is still a common Chinese character, VARCHAR(255) can store 255 Chinese characters.
As far as I know, MySQL’s support for UTF-8 is limited to 1 to 3 byte encoding lengths (Unicode: 0x0000 to 0xFFFF), which is sufficient for most of the requirements, but not for rare characters.
So what is the maximum value of VARCHAR?
According to the official documentation, VARCHAR can be up to 65535 bytes (which also means that a record has only this one field, since a MySQL line can only contain 65535 bytes).
However, it is not possible to index such a long VARCHAR, the first 1000 bytes can be indexed for MyISAM and only 767 bytes for InnoDB. (Source basis)
The benefits of setting the vARCHAR length to 255 when the vARCHAR length approaches 256:
For MyISAM, it can index the first 1000 bytes, for InnoDB, it is only 767 bytes. (Source evidence). 255X3=765
An 8-bit tinyint can represent an unsigned value ranging from 0 to 255. If the value exceeds 255, you need to apply another byte.