MySQL string type
In the MySQL database, there is no concept of string, only characters, so the database only uses single quotes.
Char(4): stores 4 characters, same as Chinese and English.
Varchar(L): To implement the variable length mechanism, additional space is needed to record the actual length of the data.
The theoretical length of L is 65535, but in fact it cannot be reached because some characters are multi-byte characters, so L cannot reach 65535
Utf8 1 character = 3 bytes
Gbk 1 character = 2 bytes
Note:
The total length of all fields of a record (excluding big data) cannot exceed 65535
The text series type stores the address in the table, occupying 10 bytes
The above is the detailed content of What are the MySQL string types?. For more information, please follow other related articles on the PHP Chinese website!